Determining the last row in a single column

前端 未结 19 1645
野性不改
野性不改 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:17

    After a while trying to build a function to get an integer with the last row in a single column, this worked fine:

        function lastRow() {
        var spreadsheet = SpreadsheetApp.getActiveSheet();
        spreadsheet.getRange('B1').activate();
        var columnB = spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
        var numRows = columnB.getLastRow();
        var nextRow = numRows + 1; 
        }
    

提交回复
热议问题