0

我们如何返回一个范围内每个项目的 A1Notation?

function getA1Notation() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = ss.getSheetByName('Sheet1');
  var range = s.getRange('A1:B3');

  for (var row in range) {
    for (var col in range[row]) 
      Logger.log(range[row][col].getA1Notation());
  }
};

我知道我们不能那样做,但这是我期待的结果......

A1 A2 A3 B1 B2 B3

4

1 回答 1

0

我这样做:

results.formulas = getRangeFormulas(guiRange);
results.a1Notation = new Array(results.formulas.length);
var guiDataSheetName = guiRange.getSheet().getName();
for (var row in results.formulas ) {
  results.a1Notation[row] = new Array(results.formulas[row].length);      
  for (var col in results.formulas[row]) {       
    results.a1Notation[row][col] = guiDataSheetName+"!" + guiRange.offset(row,col,1,1).getA1Notation();
  }
  //Logger.log("5get data"+ (new Date().getTime() - executionTime.getTime()));
}

我在循环之外获得工作表名称,因为它需要客户端服务器调用。

于 2012-09-06T05:36:28.187 回答