0

I need to convert some XLSX files to XLSB.

Before doing this I open each xlsx file with openpyxl (openpyxl to keep the data frame style).

Do you have a solution to convert it directly by openpyxl or by a python script ?

Ads
  • 13
  • 3

1 Answers1

1

You can convert an xlsx file to xlsb with this package: https://github.com/gibz104/xlsb-converter You can convert all the xlsx files in a folder:

path = test.xlsx
main(path)

Or you can convert a specific file with this:

fileList = [test.xlsx]
convertFiles(fileList)
tuurtje11
  • 189
  • 1
  • 8
  • I got an error from win32com and did this: [link](https://stackoverflow.com/questions/52889704/python-win32com-excel-com-model-started-generating-errors) specifically, I deleted the temp folder '00020813-0000-0000-C000-000000000046x0x1x9' at the location resolved by `python -c "import win32com; print(win32com.__gen_path__)"`) – alh Apr 18 '23 at 14:54
  • 1
    Hi! I can't test this right now, but deleting the temp folder can indead fix errors related to the win32com library. However, deleting this folder can also cause other issues with the library and may require re-installation or repair of Microsoft Office or other software that uses the library. – tuurtje11 Apr 18 '23 at 18:37
  • Maybe remove and re-installing helps? – tuurtje11 Apr 18 '23 at 18:37