简体   繁体   English

编写指定行号和列号的Excel文件-openpyxl

[英]Writing Excel file specifying Row and Column number - openpyxl

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 我有一个用XLWT库编写的代码,现在我切换到openpyxl因为它允许XLSX文件的行限制比XLWT允许的更多

I wrote the cells by specifying the row and column number in XLWT 我通过在XLWT指定行号和列号来编写单元格

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

Now I want to know how can I do this in openpyxl ??? 现在我想知道如何在openpyxl做到这openpyxl I have tried 我努力了

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

But I am getting an error 但是我遇到一个错误

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

它应该是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM