Can't write string/text data into XLSM file
Created originally on Bitbucket by paolofrigo (Paolo Frigo)
When I try to edit (load and save with different name) a xlsm file the result it's corrupted (if contains text data) , when I try to open it with MS Excel I can only read numeric data after recovery mode.
I've got no errors on debug, so I need help.
:
#!python
import openpyxl as px
from openpyxl import load_workbook
import os
wbname="ReportModel.xlsm"
wb = load_workbook(filename=wbname, keep_vba=True)
ws = wb.create_sheet()
ws.title = "first"
ws['F5'] = 3.14
ws['F3'] = "bazinga"
wb.save("report.xlsm")
Otherwise if I quote the line:
#!python
ws['F3'] = "bazinga"
The output file it's perfect.
Attachments: ReportModel.xlsmeditxlsm.pyreport.xlsm