Answer the question
In order to leave comments, you need to log in
How to get the values of all cells in a column?
Good afternoon!
I work with Google sheets and Google App Script.
It is necessary to get all the values of column "C" (there are more than 2 thousand cells in the column), but I ran into a problem that only a little more than 1000 values are written to the array. I get the values using the getRange(startRow, startColumn, rowsNum, columnsNum).getValues() method;
var arr = mainSheet.getRange(3,3,1500,2).getValues();
Answer the question
In order to leave comments, you need to log in
/**
* @param {GoogleAppsScript.Spreadsheet.Sheet} sheet Лист Таблицы
* @param {number} column Номер столбца
* @param {number} [startRow] Пропускает количество строк сначала
* @param {number} [numColums] Количество возвращаемых колонок
* @returns {Object[][]} Массив значений
* @see {@link https://toster.ru/q/549725}
*/
var getValuesFromColumn = function(sheet, column, startRow, numColums) {
startRow = startRow || 1;
numColums = numColums || 1;
var lastRow = sheet.getLastRow();
return sheet
.getRange(startRow, column, lastRow - startRow + 1, numColums)
.getValues();
};
var arr = getValuesFromColumn(mainSheet, 3, 3, 2);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question