Writing Excel file specifying Row and Column number - openpyxl

4.7k views Asked by At

I have a code which had written with XLWT library and now I am switching to openpyxl because it allows XLSX files that has more Row limit than XLWT allows

I wrote the cells by specifying the row and column number in XLWT

worksheet.write(1, 2, "City")

Now I want to know how can I do this in openpyxl??? I have tried

worksheet.cell(1, 1).value = "test"

But I am getting an error

AttributeError: 'int' object has no attribute 'replace'
1

There are 1 answers

1
Thibaut On BEST ANSWER

It should be:

worksheet.cell(row=1, column=1).value = "test"