Reputation: 164
I'm using openpyxl to import/export xlsx files.
But I can't import load_workbook()
the file that i exported with openpyxl.
I must open the exported xlsx file in Excel, change some value of the imported xlsx file and save it (its size changes also (for ex: from 148 Ko to 180 Ko). Then i can import it with openpyxl.
I think that there is a problem in export because after saving manually import works.
Thanks.
Upvotes: 3
Views: 1016
Reputation: 26
It seems this doesn't currently work: https://bitbucket.org/ericgazoni/openpyxl/issue/46/problem-reading-one-excel-file-and-writing
import openpyxl
wb = openpyxl.Workbook()
ws = wb.get_active_sheet()
ws.cell('A1').value = 1
wb.save('test.xslx')
wb2 = openpyxl.load_workbook('test.xlsx')
ws2 = wb2.get_active_sheet()
ws2.cell('A2').value = 2
wb2.save('test2.xlsx')
Upvotes: 1