Use inline table editing to update Google Sheets
This guide explains how to update a Google Sheets spreadsheet using inline table editing.
Before Getting Started
- Be sure to set up the Google Sheets Integration in your account.
Fetch data from Google Sheets
- Create a new Backend API with a Google Sheets step
- Update the API name to
getSheetsData
- Update the API name to
- Set the action to
Read the whole spreadsheet
- Select the Spreadsheet and Sheet name to read from
- [Optional] Check Use Row 1 of the sheet as the Table Header, if applicable
- Run the API to fetch the data
Display data in a Table component
- Drag a Table component on to the canvas
- Set the Table Data to
{{getSheetsData.response}}
Write data to Google Sheets
In this section, we'll create an API with 2 steps, the first will clear the existing spreadsheet and the second will write the Table's data into the spreadsheet.
Please note, this API will completely overwrite your spreadsheet's existing data. Be sure to follow the instructions closely, as well as test and validate on a backed up spreadsheet to prevent data loss before using on production spreadsheets.
- In the Table component's column section, update the necessary rows to be Editable
- Toggle Enable Row Insertion and Enable Row Deletion, if applicable
- Create a new Backend API with a Google Sheets step
- Update the API name to
updateSheetsData
- Update the API name to
- Set the action to
Clear the spreadsheet
- Select the Spreadsheet and Sheet name to write to
- Check Preserve Table header, if applicable
- Set the Header row number
- Create a new Google Sheets step
- Set the action to
Create spreadsheet row(s)
- Select the Spreadsheet and Sheet name to write to
- Check Include a header row in this sheet and set Header row number, if applicable
- Set Write location to
Append data starting at the first empty row
- Set Rows to append to
{{Table1.allEdits}}
- In the Table component's onSaveChanges Event Handler, add actions to Run the
updateSheetsData
API and a second action in series to run thegetSheetsData
API
Now, you can edit the data directly in the Table component. When you click Save, the data will be written back into Google Sheets and refreshed to show the latest.
Limitations
It is known behavior that writing data back into a Google Sheet will always be parsed as a string. This will be denoted by a leading '
in the cell's value.