获取在 Google 电子表格中有注释的单元格的行和列值

Get row and column value of a cell which has a note in Google Spreadsheet

我需要获取在 spreadsheet.There 中有注释的单元格的行号和列号是一种获取电子表格中所有注释或注释的方法,但我想获取的行和列索引该单元格而不是它的注释。

range.getNotes() returns 指定范围的二维数组。假设范围是 getDataRange() 然后在数组中搜索您感兴趣的笔记

    var notes = sheet.getDataRange().getNotes();
    for( var i=0; i<notes.length; i++ ) {
      for( var j=0; j<notes[0].length; j++ ) {
        if( notes[i][j] === note ) {
          Logger.log("row = "+(i+1)+" col = "+(j+1));
          return;
        }
      }
    }