I have a working code that bound into a spreadsheet. I want to run this script to other spreadsheet automatically without me opening the spreadsheet and opening the apps script editor one by one. I have read online that I must change my script into standalone script. Here is my code :
function hideRows() {
let sh = SpreadsheetApp.getActiveSpreadsheet();
let ss = sh.getSheetByName("Invoice");
let r = ss.getRange("A2:G23");
let data = r.getValues();
//console.log(data);
for (var i = 0; i < data.length; i++) {
if (data[i].filter(String).length == 0) {
ss.hideRows(i + 2);
}
}
}
Is there anything I can do? my coding skill is below basic, and sorry for my poor english.