Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

Python - Copy sheet content from old excel file 97-2003 into excel sheet 2013

$
0
0

This is my code:

wb1 = xl.load_workbook('test/workbook1.xls') # excel 97-2003 workbook
ws1 = wb1[0] # I need to get the content belonging to the first sheet

ws2 = wb['Objective'] # This is my goal workbook. The ws1 content should get copied to the Objective sheet in the ws2.
# Note: wb is a 2013 excel workbook

for row in ws1:
   for cell in row:
       ws2[cell.coordinate].value = cell.value

I am getting error:

InvalidFileException: openpyxl does not support the old .xls file format, please use xlrd to read this file, or convert it to the more recent .xlsx file format

I am a bit lost in regards to xlrd or conversion. Any assistance will be appreciated.

Thanks.


Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>