Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save response ID in Google Form to Google Spreadsheet

I am using a Google Form and it's response automatically saves to a spreadsheet. I can get response ID in a script with the form:

function submitForm2(e) {
  Logger.log(e.response.getId());
} 

I want to save the id to the spreadsheet. How can I do for that?

like image 842
user4565857 Avatar asked Feb 02 '26 00:02

user4565857


1 Answers

You would do something like:

function submitForm2(e) {
   var sheet = SpreadsheetApp.openById('----------').getSheetByName('Form responses 1');
   sheet.getRange(sheet.getLastRow(), --).setValue(e.response.getId()); 
}

Insert the ID of the target Spreadsheet and the column index of the first empty column in the sheet.

like image 149
James D Avatar answered Feb 03 '26 23:02

James D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!