Skip to content

Instantly share code, notes, and snippets.

View Elijas's full-sized avatar

Elijas Dapšauskas Elijas

View GitHub Profile
@Elijas
Elijas / findLastUsedRowsAndCols.py
Last active January 22, 2022 21:00
xlwings find used range boundaries (last used row and last used column)
import xlwings as xl
import xlwings.constants
s = xl.Book('doc.xlsx').sheets[0]
RR2 = s.api.Cells.Find(What="*",
After=s.api.Cells(1, 1),
LookAt=xlwings.constants.LookAt.xlPart,
LookIn=xlwings.constants.FindLookIn.xlFormulas,
SearchOrder=xlwings.constants.SearchOrder.xlByRows,
SearchDirection=xlwings.constants.SearchDirection.xlPrevious,