Reputation: 1246
I have a Google Form that sends data to Google Sheets document, sheet "Form responses 1". There are the following columns but I doubt it is important.: A Timestamp, B Name, C email. When a new form is submitted I want results from a new row from sheet "Form responses 1" to be copied to sheet "Results".
My code is
function onFormSubmit(e) {
var sourceSheet = e.source.getSheetByName('Form responses 1');
var targetSheet = e.source.getSheetByName('Results');
var newRowValues = e.values;
targetSheet.appendRow(newRowValues);
}
But it does not work. When a new row appears in the sheet 'Form responses 1' the sheet 'Results' is still empty.
Please tell how can I fix it.
Upvotes: 0
Views: 284
Reputation: 64100
This worked for me
function onMyFormSubmit(e) {
//Logger.log(JSON.stringify(e));
e.source.getSheetByName("Sheet0").appendRow(e.values);
}
Upvotes: 0