So I try to load an existing excel file with openpyxl
using load_workbook
and get the following error:
wb = load_workbook(filename)
File "/home/barrachina/anaconda3/envs/tf-2-cpu/lib/python3.7/site-packages/openpyxl/reader/excel.py", line 315, in load_workbook
reader.read()
File "/home/barrachina/anaconda3/envs/tf-2-cpu/lib/python3.7/site-packages/openpyxl/reader/excel.py", line 280, in read
self.read_worksheets()
File "/home/barrachina/anaconda3/envs/tf-2-cpu/lib/python3.7/site-packages/openpyxl/reader/excel.py", line 251, in read_worksheets
ws.add_table(table)
File "/home/barrachina/anaconda3/envs/tf-2-cpu/lib/python3.7/site-packages/openpyxl/worksheet/worksheet.py", line 571, in add_table
raise ValueError("Table with name {0} already exists".format(table.name))
ValueError: Table with name Table1 already exists
This happens with version 3.0.5
but didn't happen with 3.0.3
.
Writer from open office opens it without a problem, however, MS Excel has the following message:
After opening the file with Excel, saving it and closing it, it started working. However, I would have liked a solution without having to use Excel. Furthermore, this document was fully generated with openpyxl 3.0.2
so it should have been prevented to create a Table with the same name twice.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.