Danielle McCarthy
1 min readJun 9, 2020

--

Hi, Travis! You can definitely do this.

In your script editor create a new function about emailAlert that looks like this:

function loopingFunction(){
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
for (var i=0 ; i<sheets.length ; i++) {
var currentSheet = sheets[i].getName();
emailAlert(currentSheet)
}
};

The above function will get every sheet in your workbook and run the script on it. If you don’t want to run it on every sheet and only run it on 15 specific sheets you can create a list of those sheet names, let me know if you need to do that.

Then in your emailAlert function you will make 2 changes :

  1. On the line where it says function emailAlert() change it to:

function emailAlert(sheetName)

2. Below where it says //getting data from spreadsheet change it to:

var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);

Save all of this.

Lastly in the screen where you’re editing your script go to edit -> current project’s triggers and instead of running the function emailAlert open the dropdown box and select looping function.

If you are still having trouble feel free to email me daniellemccarthy54@gmail.com Medium comments are difficult to format

--

--

Danielle McCarthy
Danielle McCarthy

Written by Danielle McCarthy

Software Engineer, Virginian turned New Yorker, not a writer. Contact me @whatdanielle on Twitter & IG.

Responses (1)