dyao
dyao

Reputation: 1011

Cell referencing in Openpyxl

If I reference the value of a cell:

A1_value = ws['A1'].value

Is there a easy to reference cell A2, or B2 without having to retype out for example:

 A2_value = ws['A2'].value

Thanks!

Upvotes: 1

Views: 10099

Answers (1)

Charlie Clark
Charlie Clark

Reputation: 19537

You can access cells programmatically using ws.cell(row, column). But cells also have an .offset(row, column) method for obtaining nearby cells.

Upvotes: 4

Related Questions