Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use built-in spreadsheet functions using GAS

I just start using a spreadsheet programming with GAS but can't find the answer to my trivial question.

I want to obtain the highest number in a column in a spreadsheet.
Opening the spreadsheet and obtaining a range is not a problem, but I don't know how to use built-in spreadsheet functions like MAX()

   var ss = openSpreadsheetByName(MyName);
   var sheet = ss.getSheets()[0];
   var lastRow = sheet.getLastRow();
   var range = sheet.range(1, 1, lastRow, 1);

Now I would like to use var maxId = range.max(); or var maxId = max(range);
In general I would like to use built-in spreadsheet functions. But don't know how.

like image 819
SoftwareTester Avatar asked Jul 20 '14 18:07

SoftwareTester


1 Answers

Unfortunately, this is not possible. This is one of the oldest requests for Apps Script, see issue 26 - Enable scripts to use standard spreadsheet functions.

like image 102
Henrique G. Abreu Avatar answered Oct 11 '22 13:10

Henrique G. Abreu