google apps script function that gets a certain colomn in spreadsheet

只愿长相守 提交于 2019-12-10 11:56:56

问题


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:


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.



来源:https://stackoverflow.com/questions/14937550/google-apps-script-function-that-gets-a-certain-colomn-in-spreadsheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!