ToolJet has the capability to establish a connection with Google Sheet for both reading and writing data. By utilizing OAuth 2.0, ToolJet can establish a secure connection with Google Sheet, ensuring that the application's access to a user's account is restricted and limited appropriately.
## Self-Hosted Configuration
If you decide to self-host ToolJet, there are a few additional steps you need to take:
1. Proceed with the setup steps provided in the [Google OAuth 2.0 guide](/docs/setup/env-vars#google-oauth) to configure the necessary settings.
2. Assign the corresponding values obtained from the previous step to the following environment variables:
- **GOOGLE_CLIENT_ID**
- **GOOGLE_CLIENT_SECRET**
- **TOOLJET_HOST**
3. Activate the Google Sheets API within the Google Cloud Platform (GCP) console.
## Connection
To establish a connection with the Google Sheet data source, you can either click on the **+ Add new Data source** button located on the query panel or navigate to the **[Data Sources](/docs/data-sources/overview)** page through the ToolJet dashboard.
ToolJet allows you to select the authentication methods with Google Sheets and authorize access based on your security and access requirements.
1.**OAuth 2.0** : Authenticates via a Google user account using OAuth consent, allowing ToolJet to access Google Sheets based on the granted permissions.
2.**Service Account** : Authenticates using a Google Cloud service account, enabling server-to-server access to Google Sheets without user interaction.
**Spreadsheet ID** can be obtained from the URL of the spreadsheet. For example, in the URL `https://docs.google.com/spreadsheets/d/1W2S4re7zNaPk9vqv6_CqOpPdm_mDEqmLmzjVe7Nb9WM/edit#gid=0`, the `1W2S4re7zNaPk9vqv6_CqOpPdm_mDEqmLmzjVe7Nb9WM` represents the spreadsheet ID.
:::
### Create a Spreadsheet
This operation can be used to create a new spreadsheet.
#### Required Parameter
- **Title**
<imgclassName="screenshot-full img-full"src="/img/datasource-reference/google-sheets/create-sheet-v2.png"alt="create a spreadsheet"/>
### List All Sheets of a Spreadsheet
This operation can be used to list all sheets of a spreadsheet.
#### Required Parameter
- **Spreadsheet ID**
<imgclassName="screenshot-full img-full"src="/img/datasource-reference/google-sheets/list-all-sheets-v2.png"alt="create a spreadsheet"style={{marginBottom:'15px'}}/>
### Read Data From a Spreadsheet
This operation allows you to retrieve the table data from a spreadsheet in the form of a JSON object.
This operation allows you to retrieve basic information about the spreadsheet, including the number of sheets, theme, time zone, format, and URL, among others.
<imgclassName="screenshot-full img-full"src="/img/datasource-reference/google-sheets/info-v3.png"alt="google sheets get info"style={{marginBottom:'15px'}}/>
### Update Single Row of a Spreadsheet
This operation allows you to update existing data in a sheet.