Opens a connection to an external SQL database.
class JDBC method .getConnection()
JDBC is the Apps Script service.
.getConnection() is the method name you will see after a dot in your code.
What it does
Why it's used
- Connect Apps Script to MySQL, Postgres, or another SQL database.
- Pull live data into a sheet from outside Google.
Common errors
- Forgetting parentheses on getConnection. Write JDBC.getConnection(), not JDBC.getConnection or getConnection by itself.
- Skipping dots between chained calls. Each step needs a dot, like JDBC.getConnection().
- Adding spaces where they do not belong. Write JDBC.getConnection(), not JDBC .getConnection(), JDBC.getConnection (), or JDBC . getConnection().
- Wrong capitalization. Use JDBC and getConnection, not jdbc or getconnection.
Explore
Related methods
-
.createStatement()
Creates a SQL statement to run against the database.
-
.executeQuery()
Runs a SELECT query and returns the result set.
-
.executeUpdate()
Runs an INSERT, UPDATE, or DELETE statement.
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.getConnection().