Logging a Range in Google Apps Script -
i new using google app script , don't understand how "logger.log" command works.
i'm working google app script bound script spreadsheet. below snipet of code working on:
function tasks() { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getsheetbyname("task list"); sheet.activate(); var hi = 23; logger.log(hi); logger.log("the range " + sheet.getrange(1, 1, 10, 1)); }
when run code, displayed in logger:
[16-06-02 00:56:12:129 edt] 23.0 [16-06-02 00:56:12:130 edt] range range
why displaying "range" sheet.getrange function rather array of data.
also can please explain difference between "getrange" , "getdatarange".
the range object pointer @ range, a1:a10. different set of values in range, array of entries. values range, use getvalues
method:
logger.log("the values " + sheet.getrange(1, 1, 10, 1).getvalues());
to second question: documentation pretty clear on getdatarange does: gives range begins a1 , stretches far there data in sheet. if put data in b5 , d2, , else, datarange a1:d5. getrange
specify range want.