嗨,我正在尝试获取一个脚本,该脚本将为从我的'sheet1'
专栏创建的列表中的每个名称运行一些代码'A2:A'
1. get the list from Column A2:A
2. run code for each name from the list
这是我的代码,但它不能正常工作我认为数组没有正确填充
function test(){
var sheet = SpreadsheetApp.getActive().getSheetByName('sheet1');
var list = sheet.getRange('A2:A').getValues();
var a = [list];
a.forEach(function(entry) {
//do something
});
}
function test(){
var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1');
var lastSourceRow = sheet.getLastRow();//get last row
for (i=2; i<=lastSourceRow; i++){//ignore headers and loop
var currentName=sheet.getRange(i, 1).getValue(); //looping column A
console.log(currentName)
//process the name
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句