Insert and Update Data in Google Sheets
This guide shows you how to insert and update data in Google Sheets.
Prerequisites
- An app connected to a Google Sheets datasource.
 - A Table widget with inline editing enabled.
 - A query configured to fetch all the rows from a specific Google Sheet and bind to the Table widget.
 - A Form widget matching the table's structure to insert or update data.
 
Insert single row
To insert a row into your Google Sheet, follow these steps:
- Drag and drop a Button widget to the Form widget and rename it to 
Submit. - Select the Queries tab and create a new query.
 - Select the datasource corresponding to your Google Sheet and rename it to 
insertUserDetails. - In Operation, select Insert One.
 - Select Sheet Rows in Entity.
 - Select the Spreadsheet and Sheet name.
 - Enter the Table heading row index. The row index refers to the row in your spreadsheet that contains the headings or labels for your table columns.
 - In Row objects, paste the following code to insert a new row into the sheet where 
user_details_formis the name of the Form widget: 
{
   "id": {{ user_details_form.data.id }},
   "phone": {{ user_details_form.data.phone }},
   "name": {{ user_details_form.data.name }},
   "gender": {{ user_details_form.data.gender }},
   "latitude": {{ user_details_form.data.latitude }},
   "longitude": {{ user_details_form.data.longitude }},
   "dob": {{ user_details_form.data.dob }},
   "email": {{ user_details_form.data.email }},
   "image": {{ user_details_form.data.image }},
   "country": {{ user_details_form.data.country }}
}
- In the Form widget, set the onClick event for the 
Submitbutton using the following code: 
{{
    insertUserDetails.run();
}}
- To test, enter the data in the form and click Submit.