Read ods file after uploadind using FileUpload

48 views Asked by At

I have to make jupyter notebook that can be manualy used to upload .ods files and see it in I can read xlsx files, but have troubles with ods: i get errors or null df. How can i read ods file from bytes? Is it possible?

uploader = widgets.FileUpload(
    accept='.xlsx, .ods' ,  
    multiple=True  # True to accept multiple files upload else False
)
display(uploader)
df = pd.DataFrame()
for i in uploader.value:
    uploaded_file = uploader.value[0]
    bytes_data = uploaded_file['content']
    bytes_data = uploaded_file['content'].tobytes()
    data = BytesIO(bytes_data)
    try:
        df =  pd.read_excel(bytes_data)
    except:
        ##bytes_data = bytes_data.encode('utf-8')
        df =  read_ods(bytes_data)
0

There are 0 answers