Google Sheets
This page contains the setup guide and reference information for the Google Sheets source connector.
The Google Sheets source connector pulls data from a single Google Sheets spreadsheet. Each sheet within a spreadsheet can be synced. To sync multiple spreadsheets, use our Google Drive connector or set up multiple Google Sheets source connectors in your Calabi Connect instance. No other files in your Google Drive are accessed.
Prerequisites
- Spreadsheet Link - The link to the Google spreadsheet you want to sync.
- For Calabi Connect A Google Workspace user with access to the spreadsheet
- For Calabi Connect:
- A GCP project
- Enable the Google Sheets API in your GCP project
- Service Account Key with access to the Spreadsheet you want to replicate
Setup guide
The Google Sheets source connector supports authentication via either OAuth or Service Account Key Authentication.
Step 1: Set up Google Sheets
For Calabi Connect:
We highly recommend using OAuth, as it significantly simplifies the setup process and allows you to authenticate directly from the Calabi Connect UI.
For Calabi Connect:
We recommend using Service Account Key Authentication. Follow the steps below to create a service account, generate a key, and enable the Google Sheets API.
If you prefer to use OAuth for authentication with Calabi Connect, you can follow Google's OAuth instructions to create an authentication app. Be sure to set the scopes to https://www.googleapis.com/auth/spreadsheets.readonly. You will need to obtain your client ID, client secret, and refresh token for the connector setup.
Set up the service account key
Create a service account
- Open the Service Accounts page in your Google Cloud console.
- Select an existing project, or create a new project.
- At the top of the page, click + Create service account.
- Enter a name and description for the service account, then click Create and Continue.
- Under Service account permissions, select the roles to grant to the service account, then click Continue. We recommend the Viewer role.
Generate a key
- Go to the API Console/Credentials page and click on the email address of the service account you just created.
- In the Keys tab, click + Add key, then click Create new key.
- Select JSON as the Key type. This will generate and download the JSON key file that you'll use for authentication. Click Continue.
Enable the Google Sheets API
- Go to the API Console/Library page.
- Make sure you have selected the correct project from the top.
- Find and select the Google Sheets API.
- Click ENABLE.
If your spreadsheet is viewable by anyone with its link, no further action is needed. If not, give your Service account access to your spreadsheet.
Set up the Google Sheets connector in Calabi Connect
For Calabi Connect:
- Log into your Calabi Connect account.
- Click Sources and then click + New source.
- On the Set up the source page, select Google Sheets from the Source type dropdown.
- Enter a name for the Google Sheets connector.
For Calabi Connect:
- Navigate to the Calabi Connect dashboard.
- Click Sources and then click + New source.
- On the Set up the source page, select Google Sheets from the Source type dropdown.
- Enter a name for the Google Sheets connector.
- Select your authentication method:
- For Calabi Connect: (Recommended) Select Authenticate via Google (OAuth) from the Authentication dropdown, click Sign in with Google and complete the authentication workflow.
- For Calabi Connect: (Recommended) Select Service Account Key Authentication from the dropdown and enter your Google Cloud service account key in JSON format:
{
"type": "service_account",
"project_id": "YOUR_PROJECT_ID",
"private_key_id": "YOUR_PRIVATE_KEY",
...
}
- To authenticate your Google account via OAuth, select Authenticate via Google (OAuth) from the dropdown and enter your Google application's client ID, client secret, and refresh token.
Configuration Options
Stream Name Overrides (Rename Sheet/Stream Names)
The Google Sheets connector allows you to optionally rename streams (sheet/tab names) as they appear in Calabi Connect and your destination. This is useful if your sheet names are not descriptive, contain special characters, or you want to standardize naming across sources.
How it works
- You can provide a list of overrides, each specifying a
source_stream_name(the exact name of the sheet/tab in your spreadsheet) and acustom_stream_name(the name you want it to appear as in Calabi Connect and your destination). - If a
source_stream_nameis not found in your spreadsheet, it will be ignored and the default name will be used. - This feature only affects stream (sheet/tab) names, not field/column names.
- If you want to rename fields or column names, you can do so using the Calabi Connect Mappings feature after your connection is created. See the Calabi Connect documentation for more details on how to use Mappings.
- Renaming occurs before any other name conversion or sanitization options.
Example
Suppose your spreadsheet has sheets named Sheet1, 2024 Q1, and Summary. You want to rename them to sales_data, q1_2024, and leave Summary unchanged. You would configure:
[
{ "source_stream_name": "Sheet1", "custom_stream_name": "sales_data" },
{ "source_stream_name": "2024 Q1", "custom_stream_name": "q1_2024" }
]
After discovery, your streams in Calabi Connect will be named sales_data, q1_2024, and Summary.
How to configure
- In the Calabi Connect UI, add your overrides in the Stream Name Overrides field as an array of objects.
- If you do not wish to rename any streams, leave this field blank.
- After adding or changing a stream name override, refresh your schema in Calabi Connect to see the new stream names take effect.
- Overridden streams will default to Sync Mode: Full Refresh (Append), which does not support primary keys. If you want to use primary keys and deduplication, update the sync mode to "Full Refresh | Overwrite + Deduped" in your connection settings.
Google Sheets Connector Column Name Conversion
The Google Sheets connector offers options to customize how column names from your spreadsheet are converted to be SQL-compliant. These settings can be configured in the Calabi Connect UI when setting up the connector.
1. Convert Column Names to SQL-Compliant Format
- Description: When enabled, this converts column names to a format compatible with SQL databases (e.g., lowercasing, replacing spaces with underscores). This is the primary toggle required to enable any column name conversion.
- Default: Off
2. Additional Conversion Options
The following options allow you to fine-tune the column name conversion process. They only take effect if "Convert Column Names to SQL-Compliant Format" is enabled.
-
Remove Leading and Trailing Underscores
- Description: Removes leading and trailing underscores from column names. Note that leading underscores are preserved for column names starting with a number if "Allow Leading Numbers" is disabled.
- Example:
- Input:
" EXAMPLE Domain " - Output:
"example_domain"
- Input:
- Default: Off
-
Combine Number-Word Pairs
- Description: Combines adjacent numbers and words into a single token without separators.
- Example:
- Input:
"50th Percentile" - Output:
"50th_percentile"(if "Allow Leading Numbers" is enabled) - Output:
"_50th_percentile"(if "Allow Leading Numbers" is disabled)
- Input:
- Default: Off
-
Remove All Special Characters
- Description: Removes all special characters (e.g.,
*,?,!,$,%,(,)) from column names. - Example:
- Input:
"Example ID*" - Output:
"example_id"
- Input:
- Default: Off
- Description: Removes all special characters (e.g.,
-
Combine Letter-Number Pairs
- Description: Combines adjacent letters and numbers into a single token without separators.
- Example:
- Input:
"Q3 2023" - Output:
"q3_2023"
- Input:
- Default: Off
-
Allow Leading Numbers
- Description: Allows column names to start with numbers. If disabled, a leading underscore is added to column names that begin with a number.
- Example:
- Input:
"50th Percentile" - Output:
"50_th_percentile"(if enabled) - Output:
"_50_th_percentile"(if disabled)
- Input:
- Default: Off
Additional Details
- All converted column names are lowercased.
- Multiple spaces or special characters are collapsed or removed, not replaced with multiple underscores.
- Only single underscores are used to separate tokens.
- The result is always SQL-friendly and readable.
These options provide flexibility to tailor column name conversions to your specific database requirements. Adjust them as needed in the Calabi Connect UI when configuring the Google Sheets connector.
Header Deduplication
The Google Sheets connector automatically handles duplicate column headers by appending the cell position to create unique field names. This ensures that all columns are properly synced even when your spreadsheet contains duplicate header names.
How it works
- When duplicate headers are detected, the connector appends
_<cell_position>to each duplicated header name - The cell position follows the standard Google Sheet naming convention (e.g., A1, B1, C1, etc.)
- This creates unique field names while preserving the original header text
Example
If your spreadsheet has a header named stats in both columns C and Q (positions C1 and Q1), the connector will create two distinct fields:
stats_C1(for the column at position C1)stats_Q1(for the column at position Q1)
This ensures that data from both columns is properly captured and synced to your destination, with clear identification of which column each field represents.
Supported sync modes
The Google Sheets source connector supports the following sync modes:
Supported Streams
Each sheet in the selected spreadsheet is synced as a separate stream. Each selected column in the sheet is synced as a string field.
Calabi Connect only supports replicating Grid sheets.
Data type map
Each sheet in the selected spreadsheet is synced as a separate stream. Each selected column in the sheet is synced as a string field.
Calabi Connect only supports replicating Grid sheets.
| Integration Type | Calabi Connect Type | Notes |
|---|---|---|
| any type | string |
Limitations & Troubleshooting
Expand to see details about Google Sheets connector limitations and troubleshooting.
Connector limitations
Rate limiting
The Google API rate limits are:
- 300 read requests per minute per project
- 60 requests per minute per user per project
Calabi Connect batches requests to the API in order to efficiently pull data and respect these rate limits. We recommend not using the same user or service account for more than 3 instances of the Google Sheets source connector to ensure high transfer speeds.
Troubleshooting
- If your sheet is completely empty (no header rows) or deleted, Calabi Connect will not delete the table in the destination. If this happens, the sync logs will contain a message saying the sheet has been skipped when syncing the full spreadsheet.
- Connector setup will fail if the spreadsheet is not a Google Sheets file. If the file was saved or imported as another file type the setup could fail.
- Check out common troubleshooting issues for the Google Sheets source connector on our Calabi Connect Forum.