My row 1 is the header row and I have an onOpen() function that runs to make sure all the header titles are correct.
onOpen(){
var s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
s.getRange("A1").setValue("Order Number");
}
I have about 20+ of these headers, so every time I open it will run 20+ times regardless if the header exists or not, it will either fill or overwrite it. As you can see that's very inefficient, and I was wondering if there's a way to reduce the amount of time it runs based off of the cell's value.
I've tried a switch statement in a loop to check if the text is there and matching or not, but the running time is about the same. So is there a more efficient way to do it while optimizing running time?