As it says in the title, I want to trigger a script to run when the user adds a new sheet or tab to the spreadsheet. I also include using the "Duplicate" function. How do I achieve this?


Use the following function, coupled with a trigger "From Spreadsheet > On Change"

function newSheet(e) {
  if (e.changeType == 'INSERT_GRID') {
    Browser.msgBox('New sheet was added');  // or whatever you want to do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.