Reputation: 543
I'm trying to use python to copy data from a dat file to an excel template with openpyxl. I tried doing a few tests to play with a template and found that when I saved the file it deleted most of the existing cells and all of the graphs. I read in another question that openpyxl might not be good for editing existing spreadsheets. Is there a better option or a way to get this one to work?
This is the code I was working on just to see if I could edit the spreadsheet:
import openpyxl
wb=openpyxl.load_workbook('file.xlsm', keep_vba=True)
A=wb.get_sheet_by_name("A")
g=A['F24'].value
print g
A['A1'].value=g
print A['A1'].value
wb.save('file2.xlsm')
When I opened file2 most of the formatting, data, and all the graphs were gone.
Edit:So I'm trying out xlwings and I can't find a good tutorial or list of terms used. Anyone know where I can find that?
Upvotes: 0
Views: 1458