# Google Sheets Data Source

## Overview

When a data source powers your app, you can continuously update your app contents without having to republish it. It allows you to build a dynamic app that can create, read, update, and delete data. This doc covers connecting your app to Google Sheets as the data source.

In Google Sheets, the entire document is considered to be the data source. To use a Google Sheet as a data source, the following must be true:

* The first row in your sheet must be a header row, and every column must have a header.
* Your Google Sheet must be [sharable](https://support.google.com/docs/answer/2494822?hl=en\&co=GENIE.Platform%3DDesktop) so that Thunkable can access the data.&#x20;

## Video Tutorial

### How to Connect Your Thunkable App to a Google Sheets Data Source

In this tutorial, we’ll connect a Thunkable app to Google Sheets as a data source and display the data in our app.

{% embed url="<https://youtu.be/0YsorQtDsvc>" %}

## Connect Your App to Google Sheets

1. Click the **data icon** in the left side panel to access your data source library.
2. Click the **plus sign** at the top of the panel.&#x20;
3. You can select from previously added data sources or add a new data source. Click **Create New**.
4. Select **Google Sheets**.&#x20;
5. Sign in to your Google account and grant permission for your Thunkable accoumt to access your Google Drive.<br>

   <div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-M5WKUZDPQw2_zsl_vWB%2F-M5WVsV-XrpMPfzSGb1P%2Fsign%20in.png?alt=media&#x26;token=3d4ff936-a74e-43bd-bb49-f9f14abbeb27" alt="" width="563"></div>
6. Click **Select a Sheet.**
7. Select your spreadsheet.<br>

   <div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-M5WKUZDPQw2_zsl_vWB%2F-M5WW49s_8UHw3NCjWZs%2Fselect%20a%20file.png?alt=media&#x26;token=9d22bd0c-17d5-4394-b8e0-e55f6be6e724" alt="" width="563"></div>
8. Click **Select**.
9. Rename the data source, if you’d like.&#x20;
10. Indicate which row your column headers are in and which row is the first to contain data.
11. Click **Create**.&#x20;
12. Refresh your page to ensure the data is reflected in web preview or via the Thunkable Live app.

{% hint style="warning" %}
If you are using a G Suite for Education account and experience issues connecting to Google Sheets, contact your G Suite administrator to review your security settings.&#x20;
{% endhint %}

### .xlsx Files

Connecting to .xlsx files that are hosted on Google Sheets is not supported, but you can convert your .xlsx file to a Google Sheet before connecting it to your Thunkable app project. To do so:

1. Open the .xlsx file on Google Sheets
2. Click **File**.
3. Select **Save as Google Sheets**.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MHpB8HtC8HSyz0Kqb8S%2F-MHpBn0p_e2Fs7u99yPu%2FScreen%20Shot%202020-09-21%20at%2011.37.46%20AM.png?alt=media&#x26;token=806737ab-0b46-46f7-bbcf-aef125533783" alt=""></div>

## Display the Data in Your App

Once you've connected a data source, you can display the data in your app with a data viewer component. Learn more about data viewer components here:

{% content-ref url="../../app-design/ui-components/data-components/data-viewers" %}
[data-viewers](https://docs.thunkable.com/app-design/ui-components/data-components/data-viewers)
{% endcontent-ref %}

## Reset Your Google Sheets Connection

### Hard Refresh Your Browser

As a first step, we recommend refreshing your browser. This can fix minor issues caused by old data being stored in the browser cache.

A *"hard refresh,"* "*force reload*," *or "force refresh"* ensures that you are seeing and using the latest version of Thunkable and that any cached data that could be causing a connection issue is wiped clean and freshly retrieved.

#### Windows <a href="#h_214873c77d" id="h_214873c77d"></a>

On a Windows computer, the keyboard shortcut to hard refresh your browser is Ctrl + F5.&#x20;

#### Mac <a href="#h_9a324e5df7" id="h_9a324e5df7"></a>

On a Mac computer, you can use the Option + Cmd + R shortcut to force your browser to refresh. If this does not work for you, try clearing your browser cache.

### Reset Thunkable - Google Connection

If hard-refreshing doesn't work, you'll need to reset the connection. Start with the Reset from Thunkable instructions and then proceed to the Reset from Google instructions.

#### Reset from Thunkable

1. Login to your Thunkable account.
2. On your Projects Page, click **Data Sources** in the left sidebar.
3. Click the **trash can icon** to delete the Google Sheets data source.<br>

   <figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FDfToLc5qJ9WUgh3hrQex%2FData%20Sources%20-%20delete%20DS.png?alt=media&#x26;token=85908544-d037-4231-9b85-ddfffb25df5c" alt=""><figcaption></figcaption></figure>

#### Reset from Google

If you are having difficulties connecting your Google Sheets from Thunkable, you may need to reset your Google Sheets connection.

1. Navigate to <https://myaccount.google.com/security>
2. Scroll to the **Your connections to third-party apps & services** section.
3. Click the **Thunkable** connection.&#x20;
4. In the "Thunkable has some access to your Google Account" section, click **See details.**<br>

   <figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Fq8NDXzPqxEllfWT8SLIF%2FGoogle%20Sheets%20connection.png?alt=media&#x26;token=6c0f452e-14a9-4f5a-9d1a-9524992e19b1" alt=""><figcaption></figcaption></figure>
5. Click **Remove Access**.<br>

   <figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FzgvbwK0nGeuRnmYYoBG7%2FGoogle%20Sheets%20-%20remove%20access.png?alt=media&#x26;token=188eff4b-b07f-4677-951d-b93a7fbbc6e7" alt=""><figcaption></figcaption></figure>
6. Return to Thunkable and re-connect to your Google Sheets account.<br>

***

{% hint style="success" %}
**Have feedback on this doc?** Please take a moment to share your feedback here: [Thunkable Docs Feedback](https://docs.google.com/forms/d/e/1FAIpQLSfCwn5L2xyla-LSLZX0DSWFcFeJ43qp-r1tELCacuVS2zduLA/viewform?usp=sf_link). Your valuable insights will help us improve and better serve you in the future.
{% endhint %}
