Update a Google Sheet

Live Forms v8.0 is no longer supported. Please visit Live Forms Latest for our current Cloud Release. Earlier documentation is available too.

Update a Google Sheet

Rule syntax and best practices to follow are discussed in the Writing Rules to Retrieve and Update Data in a Google Sheet topic.

Step 1: Obtain an access token

If you do not have an access token for your Google Account, perform this one time step.

Step 2: Add the Business Rule

We’ve created a simple example form. Select the employee, a location and a new extension number. Click the Update Google Sheet button, wait a few seconds and see that the sheet was successfully updated. We did this using this rule:

/*member password, user*/ if (UpdateGoogleSheet.clicked) { var eid = EId.value; // Unique key in the Google Sheet row var headers = {"user":"<google id>","password":"<your access token>"}; var updatequery = '/google/spreadsheets/update/key/<your spreadsheet key>?wsname=Locations&query=employeeid="' + eid + '"'; var updateparams = '&updates=location=' + Location.value + ',extension=' + Extension.value; eval('x=' + http.put(updatequery + updateparams, null, headers, false)); }
  1. It’s triggered by clicking on the Update Google Sheet button.

  2. We setup headers and an update query using your access token and spreadsheet key (the long ID in the URL of the Google Sheet). In this example, the name of the Google Sheet tab is Locations. Change the wsname= parameter to the name of your Google Sheet tab if you named the tab something different.

  3. Add updateparams: we’re updating location and extension with new values.

  4. Run the update – perform an http.put() and eval the results.

Step 3: Try it yourself using the sample form