I am getting the contents of my excel file in base64. I want to decode the file and load it in with xlrd in order to extract some information from it.
What I have tried:
import base64
from xlrd import open_workbook
encoded = get_file_content() # retrieving the contents of xls in base64 form
decoded = base64.b64decode(encoded)
type(decoded) #=> <class 'bytes'>
xlsfile = open('file.xls', 'wb')
xlsfile.write(decoded)
xlsfile.close()
workbook = open_workbook('file.xls')
I get the following error:
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'F\x8a-\x12{k\xc9j'