Creates a SQL statement to run against the database.
class JDBC method .createStatement()
JDBC is the Apps Script service.
.createStatement() is the method name you will see after a dot in your code.
What it does
Why it's used
- Run SQL after you open a database connection.
- Execute queries or updates against external data.
Common errors
- Forgetting parentheses on createStatement. Write JDBC.createStatement(), not JDBC.createStatement or createStatement by itself.
- Skipping dots between chained calls. Each step needs a dot, like JDBC.createStatement().
- Adding spaces where they do not belong. Write JDBC.createStatement(), not JDBC .createStatement(), JDBC.createStatement (), or JDBC . createStatement().
- Wrong capitalization. Use JDBC and createStatement, not jdbc or createstatement.
Explore
Related methods
-
.executeQuery()
Runs a SELECT query and returns the result set.
-
.executeUpdate()
Runs an INSERT, UPDATE, or DELETE statement.
-
.getConnection()
Opens a connection to an external SQL database.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.
Related blog posts
Written guides about JDBC.createStatement().