Retool

Documentation

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 pulling in data from Google Sheets, querying it via SQL, and joining it with anything else. 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).

Google sheets is currently supported on cloud as well as on premise.

Setup

To setup Google Sheets, you'll need to follow the Google Sheets setup instructions.

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 {{googleSheetsBudget.data}}
order by budget::int ASC;

Filtering with a like

select * from {{googleSheetsBudget.data}} 
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:

select
  users.*, payments.*
from
  {{ userSheets.data }} as users,
  {{ paymentsApi.data }} as payments
where
  users.id = payments.user_id

Google Sheets

Query data from Google Sheets in Retool.