nithinmurali / pygsheets

Google Sheets Python API v4

Home Page:https://pygsheets.readthedocs.io/en/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a function to GET the last used row & column in the wks?

sneakerush opened this issue · comments

As the title states, how can i GET the last used row and column in the worksheet? Edit: Without reading all the data and being resource intensive

Converting to dataframe is too resource intensive?

wks.get_as_df().iloc[-1,-1]

Other option would be the worksheet having the same size of the data used. And than getting wks.rows and wks.cols numbers, and get the value at this point.

Both of the above options would work. Unfortunately there is no sheets API for this. YOu can use the append_table as a workaround for this though.

Call the append_table with values=[], In the requests it would return details of the last row and column.

https://pygsheets.readthedocs.io/en/stable/worksheet.html#pygsheets.Worksheet.append_table