rohanpatni
rohanpatni

Reputation: 43

How to write on first empty row through xlwings?

The excel file has content in A1, A2 , A3. I want python to automatically write the output in first empty cell in column A .i.e it should write on A4

Another example - lets say if I have content written from B1 to B130. Here I would like python to write the desired result in cell B131.

How do I form a python solution that can perform this task in excel through xlwings ?

Upvotes: 0

Views: 2393

Answers (1)

Atreyagaurav
Atreyagaurav

Reputation: 1195

if your data is continuous, get the end of the current region to get the last cell then offset the cell by one to get the next empty cell.

cel = Range("A1:A2")
rng = cel.current_region
last_cel=rng.end("down")
empty_cell= last_cel.offset(1,0)

now you can do what you want with the empty_cell

Upvotes: 2

Related Questions