I try to use open and save a
.xlsm file with
openpyxl. However, the
.xlsm file can't be opened by excel.The ultimate goal is to add content to an existing worksheet in that specific workbook. I use the following code in a python 3.4 , win7 and excel 2010 envirnoment.
from openpyxl import load_workbook fileDir = 'Z:\' wb = load_workbook(filename = fileDir + 'temp.xlsm', keep_vba=True) wb.save(fileDir + 'temp.xlsm')
The error message i receive when i try to open the file with excel is (excel error 101648):
"Excel found unreadable content in 'filename.xlsx'. Do you want to recover teh contents of this workbook? If you trust the source of this workbook, click Yes. (Yes) (No)"