Data Sources

The Data Sources blocks allow you work with the information that you have stored in your connected Airtable Bases, Google Sheets or Local Tables.

The Data Sources blocks allow you to perform a variety of CRUD (Create, Read, Update, Delete) operations on records that you have stored in Airtable, Google Sheets or Local Tables.

Add a Data Source to your App

To access the Data Sources blocks you need to add a Data Source to your app. There are two ways to do this:

In the modal that appears, you can choose a previously connected Data Source, or add a new Data Source.

Adding a New Data Source

When adding a new Data Source, you can choose between Create your own table, Airtable or Google Sheets as the source of your data.

Create your Own Table

Start by naming your data source.

You can now see this Data Source from your Data Sources section. Click on the Data Source name to edit it.

The data editor allows you to edit, add, and delete columns of information. To change any of the individual values simply click on the cell and type whatever you like.

Airtable

Connect Your App to Airtable by OAuth

  1. Click Connect to Airtable.

  2. In Thunkable, click the data icon in the left side panel to access your data source library.

  3. Click the plus sign at the top of the panel.

  4. You can select from previously added data sources or add a new data source. Click Create New.

  5. Select Airtable.

  6. Click the OAuth tab.

  7. An Airtable authorization screen opens.

  8. Click + Add a base.

  9. Select the bases you want to authorize access to.

Select all the bases you want your Thunkable projects to have access to. This includes any bases you've previously connected by API key, as well as any new bases you want to connect to Thunkable.

  1. Click Grant access.

If you are connecting by OAuth for the sole purpose of migrating your connection from API Key and are not creating a new data source, you are done. The following steps only apply when creating a new data source.

  1. Select the correct base from the dropdown menu.

  2. Indicate if you'd like to use a custom view. Learn more here: Use a Custom View.

  3. Click Create.

  4. Refresh your page to ensure the data is reflected in web preview or via the Thunkable Live app.

Authorization Header For Block

This block is only necessary for Creators who use web API blocks to communicate with Airtable.

If your app uses web API blocks to communicate with Airtable, you must also incorporate the "authorization header for" block into your app. This block retrieves a valid token that can be used as the authorization header in web API blocks.

To use the "authorization header for" block:

  1. Ensure your project is connected to an Airtable data source by OAuth.

  2. Navigate to your project's blocks tab.

  3. Under the App Features heading, click Data Sources.

  4. Drag and drop the "authorization header for" block into your workspace.

  5. Use the block's dropdown menu to ensure the correct data source is selected.

Google Sheets

In Google Sheets, the entire document is considered to be the data source.

In order to use a Google Sheet as a Data Source, the first row in your Sheet must be a header row.

Your Google Sheet must be shareable for Thunkable to access its data.

To connect a Google Sheet, sign in and grant permission for your Thunkable project to access your Google Drive.

Some users have reported issues connecting to Google Sheets if they are using G Suite for Education accounts. You may need to contact your G Suite administrator to review your security settings.

Once you have allowed this, you will see a list of spreadsheets in your Google Drive. If you don't seen the sheet you are looking for you can switch to list view, sort alphabetically or search for the one you need. Click Select to return to your Thunkable project.

At this time, connecting to .xlsx files that are hosted on Google Sheets is not supported. You can convert your .xlsx file to a Google Sheet before connecting it to your Thunkable app project. Simply open your .xlsx file on Google Sheets, then click File > Save as Google Sheets.

Looking to reset your Google Sheets connection? Click here for instructions

Data Source blocks

Create

The create row inblock allows you to append new rows to the end of your data tables.

The inputs are dynamic so if you change the name of Column 1 or Column 2 in the designer these changes will be reflected in the block too.

There is a second create row in block which allows you to add a row in your data source using an object. The field is the column name and the cell info is the value you would like to set.

Read

The get value from blocks allows you get read one value from a specific cell in your data table. You can specify the column name in the block itself and pass the unique row id as an input.

The valid id types are index and unique id. The index refers to the row by its integer position (1 for the first row, 2 for the second row, etc.) and must be greater than zero.

Get row object will return the row object of the specified row ID. The row object can be used with Objects blocks.

The list of values in block allows you to read an entire column of data from a table and returns it as a list that you can then manipulate with the built-in List blocks.

The number of rows in block returns an integer corresponding to how many rows are in a given table.

The columns in block returns the column names of a data source

Update

You can use the update value in block to modify or update an existing cell in your data table. The column name is specified in the block itself. Both the row id and new value are passed as inputs.

There is a second update row in block which allows you to update a row in your data source using an object. The field is the column name and the cell info is the value you would like to set.

Delete

Delete Row

You can use the Delete Row block to delete a row of data from your Data source. The row id is passed as an input. If there is an error, the error message is passed as an output.

Delete All Rows

You can use the delete all rows block to delete all rows in your data source. If there is an error, the error message is passed as an output.

Last updated