``````=LAST(G2:G9999)
``````

``````=INDEX(G2:G, COUNT(G2:G))
``````

``````=+sort(G:G,row(G:G)*(G:G<>""),)
``````

``````=indirect("R"&ArrayFormula(max((G:G<>"")*row(G:G)))&"C"&7)

(G:G<>"") gives an array of true false values representing non-empty/empty cells
(G:G<>"")*row(G:G) gives an array of row numbers with zeros where cell is empty
max((G:G<>"")*row(G:G)) is the last non-empty cell in G
``````

``````=FILTER( A10:A100 , ROW(A10:A100) =MAX( FILTER( ArrayFormula(ROW(A10:A100)) , NOT(ISBLANK(A10:A100)))))
``````

``````=INDEX(G2:G; COUNT**A**(G2:G))
``````

``````=INDEX(G2:G; COUNTA(G2:G))
``````

``````function lastRow(column){
var lastRow = sheet.getLastRow();
var lastRowRange=sheet.getRange(column+startRow);
return lastRowRange.getValue();
}
``````

``````=ARRAYFORMULA(LOOKUP(2,1/(G2:G<>""),G2:G))
``````

`G2:G<>""`創建1 / true（1）和1 / false（0）的數組。 由於`LOOKUP`使用自頂向下的方法來查找`2`並且因為它永遠不會找到2，所以它會出現在最後一個非空白行並給出了它的位置。

``````=INDEX(G2:G,MAX((ISBLANK(G2:G)-1)*-ROW(G2:G))-1)
``````

V18

``````=INDIRECT("R[-"&COUNTBLANK(V4:V17)+1&"]C",0)
``````

``````=INDEX(I:I;MAX((I:I<>"")*(ROW(I:I))))
``````

``````function getDashboardSheet(spreadsheet) {
var sheetName = 'Name';
}
Logger.log('see:'+dashboardSheet.getLastRow());
``````

``````//Note that this function assumes a single column of values, it will
//not  function properly if given a multi-dimensional array (if the
//cells that are captured are not in a single row).

function LastInRange(values)
{
for (index = values.length - 1; values[index] == "" && index > 0; index--) {}
return String(values[index]);
}
``````

``````=LastInRange(D2:D)
``````

``````=INDEX(  FILTER( H:H ; NOT(ISBLANK(H:H))) ; ROWS( FILTER( H:H ; NOT(ISBLANK(H:H)) ) ) )
``````

``````\$ =INDEX(G2:G; COUNT(G2:G))
``````

``````\$ =INDEX(G2:G100000; COUNT(G2:G100000))
``````

``````=LAST(G2:G9999)
``````

``````=INDEX(G2:G; COUNT(G2:G))
``````

2017更新：使用Stackdriver Logging for Google Apps Script調試Event對象 。 從腳本編輯器的菜單欄中，轉到： `View > Stackdriver Logging`以查看或流式傳輸日誌。

console.log()將編寫`DEBUG`級別消息

``````function onEdit (e) {
var debug_e = {
authMode:  e.authMode,
range:  e.range.getA1Notation(),
source:  e.source.getId(),
user:  e.user,
value:  e.value,
oldValue: e. oldValue
}

console.log({message: 'onEdit() Event Object', eventObject: debug_e});
}
``````

``````function onFormSubmit (e) {
var debug_e = {
authMode:  e.authMode,
namedValues: e.namedValues,
range:  e.range.getA1Notation(),
value:  e.value
}

console.log({message: 'onFormSubmit() Event Object', eventObject: debug_e});
}
``````

``````function onChange (e) {
var debug_e = {
authMode:  e.authMode,
changeType: changeType,
user:  e.user
}

console.log({message: 'onChange() Event Object', eventObject: debug_e});
}
``````