Integration with Google Sheet - OnChange event type | Community
Skip to main content
Question

Integration with Google Sheet - OnChange event type


Forum|alt.badge.img+1

I am using Google Apps script to detect new data record added (by Typeform) to the spreadsheet.

On the spreadsheet, only the event type = ‘On Change’ is triggered (not OnEdit).

While the Typeform writes all data for the survey (questions, fields, submitted at, token), only the questions data show up in the event source data object. The first 18 columns are questions, the rest are fields (hidden and custom), followed by Submitted At and Token.

Note that the spreadsheet has all columns populated and I can read with standard App script function on the sheet. However, I want to read the new/modified data as part of the event object.

Example:

The event object only shows the data

[[true, 4.0, 9.0, 7.0, 5.0, 2.0, 4.0, 5.0, , , 0.0, 3.0, , , Starting to figure it out]]

 

The sheet lastRow function shows all the columns

[true, 4.0, 9.0, 7.0, 5.0, 2.0, 4.0, 5.0, , , 0.0, 3.0, , , Starting to figure it out, , John, Doe, john.doe@acme.com, 55.0, 15.0, 0.0, 0.0, 0.0, 65.0, 60.0, 0.0, 20.0, 43.61, potter, 1.0, 9.0, 4.0, Mon Aug 26 21:27:05 GMT-04:00 2024, mo989p989oxgmo989pdwk1keiv6gnzkp]

Question: Does Typeform write a record to the sheet in two batches? First the questions and then then rest? If ‘yes’, why is the triggered fired only once? if ‘no’ then why does the event data object not have all the records? 

Or Does Typeform write the first 15 columns and then the rest? Please note that the answer ‘Starting to figure it out’ appears in different column position in the data (same column in the spreadsheet)

Case 1:
Info [[true, 4.0, 9.0, 7.0, 5.0, 2.0, 4.0, 5.0, , , 0.0, 3.0, , , Starting to figure it out]]

Info [true, 4.0, 9.0, 7.0, 5.0, 2.0, 4.0, 5.0, , , 0.0, 3.0, , , Starting to figure it out, , John, Doe, john.doeatacme.com, 55.0, 15.0, 0.0, 0.0, 0.0, 65.0, 60.0, 0.0, 20.0, 43.61, potter, 1.0, 9.0, 4.0, Mon Aug 26 21:27:05 GMT-04:00 2024, mo989p989oxgmo989pdwk1keiv6gnzkp]

Case 2:
Info [[true, 4.0, 7.0, 5.0, 1.0, 9.0, 6.0, 3.0, , 5.0, 3.0, 8.0, , 9.0, 2.0]]

Info [true, 4.0, 7.0, 5.0, 1.0, 9.0, 6.0, 3.0, , 5.0, 3.0, 8.0, , 9.0, 2.0, , , Starting to figure it out, Charlotte, 2323, John, Doe, John.Doeatacme.com, 55.0, 55.0, 0.0, 0.0, 0.0, 53.33, 55.0, 30.0, 0.0, 90.0, 56.39, Tue Aug 27 00:27:57 GMT-04:00 2024, xhash5nvjmfh6cgxxixhashp6y8fbxcx]
 

4 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14971 replies
  • August 27, 2024

Hi @jervin31 This is...a very good question that I have never been asked. (And I’ve been asked a lot of questions at my time here!) 

Let me ask the developers about this for you! 


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14971 replies
  • August 29, 2024

Hi @jervin31 ! Alrighty, here is what the product team told me: 

Yes, the data is sent to Google in two parts, and we insert everything using a batch update from the Google API (so theoretically it should be atomic). As for not receiving all of the events, there is this Google community forum where more users ask why are not receiving any events, so our theory is that Google doesn't support this, but it would be something to ask them directly.


Forum|alt.badge.img+1
  • Author
  • Explorer
  • 10 replies
  • August 30, 2024

Hi @Liz , ‘sent to Google in two parts’, that’s what I guessed and the Google Sheets community too.

The app script only OnChange event type detects the first part, and is not triggered by the 2 part (probably too quick succession). Is there a reason why the Typeform sends the update in two parts if all the information is available ahead?

 


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14971 replies
  • September 2, 2024

Let me ask the developers, @jervin31 ! I’m not totally sure why the events are sent in two batches. I’ll find out for you!


Reply