I'm trying to pull data from an Adwords report to a Google Sheet through an Adwords script. This will be done on a daily basis. Every time the Adwords script runs, a new tab is created (and an old one is to be deleted) on the Google sheet. I'm trying to figure out how to use the 'Creation of a New Tab' event to trigger a script in GSheets that will run a (V)lookup between the newly created tab and an existing tab on the Sheet. So essentially this whole process summed up is as follows:

i) Adwords script to pull data to a G Sheet daily - done
ii) G Sheet script to look up a value in the new tab and compare against a value in an existing tab. - currently stuck
iii) Build yet another tab "Tab C" to collect the records with different values
iv) G Sheet script to send email notification with output of "Tab C"
v) G Sheet script to Delete an older tab

As you can imagine, this is way beyond my coding skills at the moment. So any ideas appreciated.


1 Answer 1


The closest to 'Creation of a New Tab' event is the Change event but this and the other events triggered by "actions" only works for changes made by a user through the Google Sheets user interface.

UPDATE: the Change event also works for changes made through the Google Sheets API

In order to make the tasks after the creation of the new sheet (tab), the "first option" is to modify the Adwords script by adding the corresponding commands after the code line that creates the sheet.

If you don't want or can't do that here are some alternatives

  • use a time-driven trigger programmed to run a certain time after the Adwords script run.
  • use an open trigger that runs every time that the spreadsheet is open.
  • add a button or custom menu to manually trigger the script.
  • use the Google Apps Script IDE to run the script.


  • function newSheet(e) { Logger.log(e.changeType); if (e.changeType == 'INSERT_GRID') { // vlookup function to follow } would the above not work? Thanks btw. Time-driven trigger might be a possibility if this breaks. What changes would you propose to the adwords script? Feb 21, 2019 at 16:54
  • @SanketDhume I don't know the Adwords script, so I can't propose changes to it. I made a small change to my answer. Feb 21, 2019 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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