google apps script function that gets a certain co

2019-06-09 06:44发布

Can I create a Google apps script that gets information from a whole Colomn in a apps spreadsheet and do upon it an action?

I've searched the Class spreadsheet link https://developers.google.com/apps-script/class_spreadsheet but i don't know which method I am going to use actually, anyone can help giving me a push? I am new to the Google apps scripts

1条回答
叛逆
2楼-- · 2019-06-09 07:14

Always use the .getRange() method to select what cells you want. Then to get all the values, you call .getValues(). Example:

var vals = sheet.getRange("C2:C").getValues();

Now vals is a 2 dimensional array that is accessible by vals[rowNum][colNum]. If you're grabbing only one column, the colNum will always be 0.

查看更多
登录 后发表回答