I'm looking for appscript to automatically copy rows to MULTIPLE (2) spreadsheets on edit (or on form submittal)

Viewed 29

These 2 sheets that will receive the information need to be able to manipulate the data separately from each other. I know I've seen scripts that can do this for multiple sheets based on a column, but these sheets I need will be identical, just used in two different ways.

  1. when form is submitted, the script will run
  2. only the new row will be copied
  3. only the new row will be pasted to 2 different sheets (that can each do it's own deleting of rows when needed)
  4. it will be pasted after the last row on each sheet This link has the form responses and the two sheets I'm trying to copy to.

Sample spreadsheet link

This code was working to copy to ONE sheet on the original that I have, except it didn't put the row in at the end. But when I created this test to link, it is not working.

Thanks for any help.

1 Answers

Copy Submitted values to multiple spreadsheets

function onFormSubmit(e) {
  let idx = [0,1];
  ["id0","id1"].forEach((id,i) => {
    let ss = SpreadsheetApp.openById(id);
    let sh = ss.getSheets()[idx[i]];
    sh.appendRow(e.values)
  })
}
Related