Skip to main content
Question

To get last row of the excel

  • 18 January 2022
  • 4 replies
  • 786 views

I am connecting Excel as database and want to get last not null row of a column in a table​

Could you please below Query and use the loop to get the last value.

 

SELECT TOP 1 * FROM Table ORDER BY ID DESC

 


But this query is not giving me last row item...it gives some random values from the co​lumn.


In stead of using Excel as database, you could use Excel function to go to A1, then go to the end of the column A, to reach the last row of the column in a table.


Excel Advanced: Open

Excel Advanced: Go to cell (selecting End of the column)

Excel Advanced: Get cell adress of active cell

 

That gives you the cell adress of the last not null row.

Just remove the letter from the cell adress, and you will have the row number


Reply