Welcome to Retool! We're a fast way to build custom internal software.

You'll find the 5 minute demo, quickstart guide, and documentation for each of our connectors and components here. If you've got any questions -- chat with us on the bottom right!

Get Started    Guides

Google Sheets

Query data from Google Sheets in Retool.

Retool supports reading and writing data from Google Sheets. And with Retool's query JSON via SQL, you can easily combine with other datasources. For example - you could pull in user data from Sheets, join it via SQL to payment data from your database, and then pull in more data for each payment via an API (eg. Stripe).


Follow the cloud setup instructions if your Retool dashboard is located at, where username is your username. Otherwise follow the on-premise setup instructions.

Cloud setup

  1. Go to your Retool dashboard.
  2. Navigate to the Resources page.
The Resources page

The Resources page

  1. Click Add.
  2. Click Google Sheets.
  3. For Label type Google Sheets, or call it something else.
  4. Flip Enable writing back to Google Sheets to Yes if you want to be able to write data from Retool to Google Sheets.
  5. Click Connect to Sheets.

On-premise setup

See Google Sheets setup instructions.

You will have the option to enable Retool to write back to Google Sheets at this step.

Expected sheet format

When getting data from a sheet that already exists, Retool expects the top row of a sheet to contain field names.

Expected sheet format

Expected sheet format

Querying a sheet to return all values returns an array of objects like the one below.

How Retool formats a sheet's values

How Retool formats a sheet's values

Using it

1. Getting the data from Google Sheets

Select a Google Sheets resource, and choose a spreadsheet to query in the dropdown.

You'll have to specify the sheet range. If you want to query the whole sheet, just enter the name of the sheet. By default, the first sheet is called Sheet1:

Finding the sheet name inside Google Sheets.

Finding the sheet name inside Google Sheets.

You can also specify sheet ranges via A1 notation:

A1 Notation
This is a string like Sheet1!A1:B2, that refers to a group of cells in the spreadsheet, and is typically used in formulas. For example, valid ranges are:

  • Sheet1!A1:B2 refers to the first two cells in the top two rows of Sheet1.
  • Sheet1!A:A refers to all the cells in the first column of Sheet1.
  • Sheet1!1:2 refers to the all the cells in the first two rows of Sheet1.
  • Sheet1!A5:A refers to all the cells of the first column of Sheet 1, from row 5 onward.
  • A1:B2 refers to the first two cells in the top two rows of the first visible sheet.
  • Sheet1 refers to all the cells in Sheet1.

If the sheet name has spaces or starts with a bracket, surround the sheet name with single quotes ('), e.g 'Sheet One'!A1:B2. For simplicity, it is safe to always surround the sheet name with single quotes.

2. Manipulating the Google Sheets data via SQL

If you want to filter, sort, or otherwise manipulate your Sheets data, you can query it via SQL.

Just make a new query, with the resource Query JSON with SQL, and start typing SQL. To refer to the data from Google Sheets, use .data:

select * from {{}}
order by budget::int ASC;

Filtering with a like

select * from {{}} 
where item ILIKE {{'%' + textinput1.value + '%'}}
order by budget::int ASC;

Joining Google Sheets to another resource (Sheets or otherwise)

You can also join Google Sheets data with other objects in Retool - whether they're from an API, database, or Sheets:

  users.*, payments.*
  {{ }} as users,
  {{ }} as payments
where = payments.user_id

Updating data in Google Sheets

You need to grant Retool edit access to your Google sheets!

In order to use the features below you need to change your Googlesheets connection to allow for editing values, and then you'll have to reauthorize Retool.

Retool currently supports creating new Google spreadsheets appending data to a spreadsheet, and updating data in an existing spreadsheet.

Creating a Google spreadsheet

To create a new Google spreadsheet from Retool, you can use the interface below to customize the title of the new spreadsheet.

After running the query, the data property of the query will contain various metadata about the spreadsheet including the spreadsheet id and the spreadsheet url.

One common feature you can use is to display the created spreadsheet in an IFrame component. For example, below you can access the spreadsheet url returned by the createSpreadsheet query

Appending data to your Google spreadsheet

Suppose you have data from an SQL query and you would like to insert this into your Google spreadsheet. You can use the append action type to accomplish this goal.

In above, we have appended to the Google spreadsheet some data from the usersDb SQL Query. If you had used an IFrame to display the Googlesheet, you should see the spreadsheet automatically update once the query finishes thanks to Google sheet's auto-updating functionality!

Retool supports three different formats for data to append to a Google spreadsheet. Here are three equivalent expressions

Array of arrays

  [ "Name", "Job", "Age" ],
  [ "Chris", "Teacher", 24 ],
  [ "Mary", "Engineer", 29 ]

Array of objects

  { "Name": "Chris", "Job": "Teacher", "Age": 24 },
  { "Name": "Mary", "Job": "Engineer", "Age": 29 }

Columnar format (data returned by an SQL Query)

  "Name": ["Chris", "Mary"],
  "Job": ["Teacher", "Engineer"],
  "Age": [24, 29]

Updating data on your Google spreadsheet

You can use the update action type to update data on your spreadsheet. Let's say our spreadsheet looks something like this:

And let's say we want to timmy's status from "ooo" to "available". The cell corresponding to Timmy's status is C3, so we can update it like this:

Google Sheets

Query data from Google Sheets in Retool.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.