Determining the last row in a single column

前端 未结 19 1523
野性不改
野性不改 2020-11-22 10:46

I have a sheet with data in cols A through H.

I need to determine the last row in column A that contains data (it\'s all conti

19条回答
  •  执念已碎
    2020-11-22 11:06

    I am using getDataRange() followed by getNumRows(). The first function

    Returns a Range corresponding to the dimensions in which data is present

    and the second function

    Returns the number of rows in this range.

    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var ws = ss.getActiveSheet();
    var lastRow = ws.getDataRange().getNumRows();
    

    P.S I hope this works for all cases.

提交回复
热议问题