I have a multi-sheet excel file saved in a .xlsb format that I wish to covert to .xlsx to utilize the openpyxl library - code already written to support the same workbook that used to be .xlsx until macro-enabled, and wouldn't save in .xlsm.
I have managed to convert from .xlsb to .csv, but cannot convert any further and have hit roadblocks with various libraries due to various formatting errors.
As my file has multiple sheets (all tables) I only need to copy and paste the text on every sheet (keeping the sheet names) and get it to a .xlsx format.
For simplicity sake, imagine all I need to do is: get sheet names, access a sheet, determine max row/column, loop: copy and paste cell values, write to .xlsx with sheet name. With the starting file being .xlsb.
Any suggestion would be much appreciated.
Just tested this.
Pandas now supports xlsb and can open these files using Glen Thompson's method described in Read XLSB File in Pandas Python:
import pandas as pd
df = pd.read_excel('path_to_file.xlsb', engine='pyxlsb')
And then you could use:
df.to_excel('path_to_file.xlsx')
Make sure you pip install pyxlsb, openpyxl and xlrd, I always forget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With