I have a script, which works in a tab, which is hardcoded in the line 4 (Sheet1):
function fillColumn() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet1');
const values = sh.getRange('A2:A'+sh.getLastRow()).getValues().flat([1]);
var toCopy;
values.forEach((el,index)=>{
if (el != ''){
toCopy = sh.getRange(index+2,1).getValue();
} else {
sh.getRange(index+2,1).setValue(toCopy)
}
})
}
What is the correct way to add a list of tabs, to make script working in tabs Sheet1, Sheet2, Sheet12? I tried some notations, but they were all erroneous.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…