1

May be this question is very common but right now i am very much stuck into it. I have made a script that will read a .xlsx excel file and will plot a graph on the basis of some data in it.

Now i have a .xlsm file.I want to convert this .xlsm file to .xlsx file so that i can use the same script with this file because the content of both the file are same.I have tried converting it using openpyxl but after converting it to .xlsx the script is giving wrong result for it.But when i am manually converting .xlsm to .xlsx format then the script is working fine.

the code that i am using for converting .xlsm to .xlsx is-

from openpyxl import Workbook

from openpyxl import load_workbook
wb = load_workbook('Excel.xlsm',read_only=False ,keep_vba=False)
ws = wb['K0 Reg Patch Util']

wb.save('Excel.xlsx')

can somebody please point me how to convert .xlsm file to .xlsx file.It would be a great help.

rikki
  • 431
  • 1
  • 8
  • 18
  • 1
    Possible duplicate of [How to convert .xlsm (macro enabled excel file) to .xlsx using Python?](https://stackoverflow.com/questions/39292179/how-to-convert-xlsm-macro-enabled-excel-file-to-xlsx-using-python) – godot Sep 11 '18 at 11:46
  • 1
    I have also read that post but I want to do it using openpyxl. Is there any way to do it with openpyxl-@godot – rikki Sep 11 '18 at 11:52
  • As written in the documentation, this will fail. Scroll down to the last **Note** [saving-to-a-file](https://openpyxl.readthedocs.io/en/stable/tutorial.html#saving-to-a-file) – stovfl Sep 11 '18 at 13:36

0 Answers0