I am attempting to use the code in the above Stack post to save a .xlsm to a .xlsx using win32com in Notebook and it is not working.
There are many other suggestions for converting a .xlsm to .xlsx and each one of them relies on using some version of "Save" (SaveCopy, SaveAs, etc.) and none of them are working for me.
The error I keep getting is: xlsxwriter object has no attribute 'fill in the blank'
Keep in mind that I am fairly new at this (thank you)
Please help!
#Export xlsm to xlsm)
import win32com.client
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Application.Quit()
# Load the .XLSM file into Excel
wb = excel.Workbooks.Open(r'S:\ALL\GIS\Software\NIGHTLY_UPDATES\GIS_CAMA_RECONCILIATION\RECONCILIATION_STAGING\GIS_CAMA_Reconciliation1.xlsm')
# Save it in .XLSX format to a different filename
excel.DisplayAlerts = False
writer.DoNotPromptForConvert = True
writer.CheckCompatibility = False
writer.SaveAs(r'S:\ALL\GIS\Software\NIGHTLY_UPDATES\GIS_CAMA_RECONCILIATION\RECONCILIATION_STAGING\GIS_CAMA_Reconciliation1.xlsx', FileFormat=51, ConflictResolution=2)
excel.Application.Quit()
del excel
print(".XLSM Saved as .XLSX")
AttributeError: 'XlsxWriter' object has no attribute 'SaveAs'
It would help if you formatted your code. Click the ... then </> to paste and select the code flavor.
I don't see where writer is created. XlsxWriter and win32com has some quirks.
Have you tried wb.saveAs(..)?