获取在Google Spreadsheet中具有注释的单元格的行和列值

时间:2018-08-22 17:29:40

标签: google-apps-script google-sheets google-sheets-api

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

1 个答案:

答案 0 :(得分:0)

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

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    private static object mike = "mike"; // give the variable a value to hold
    private static object gus = "gus"; // give the variable a value to hold
    private static object julio = "julio"; // give the variable a value to hold
    public static void Main()
    {
        object[] names = new object[3];
        names[1] = mike;
        names[0] = gus;
        names[2] = julio;
        WriteAnswer(" you're cool ", names);
    }

    static void WriteAnswer(string description, object[] result)
    {
        for(int i = 0; i < result.Length; i++)
        {
            Console.WriteLine(description + result[i]);
        }

    }
}