tlocke/odio

Spreadsheets saved by libreoffice are not parsed correctly

Closed this issue · 3 comments

Expected output:

['324', '', '180713064', 'prova fibra UV800', 'dark', '-', '10', '3', 'SMV', 'UV800', '-', '-', '-', '-', '', '', '', '']

Actual output:

['', None, '', '', '', '', '', '', '', '', '', '', '', '', None, None, None, None]

You should reproduce the problem with this script:

import csv
import odio

with open('logbook.csv') as logbook:
    table = csv.reader(logbook)

    with open('logbook.ods', 'wb') as f:
        with odio.create_spreadsheet(f, version='1.2', compressed=True) as sheet:
            sheet.append_table('table1', table)

with open('logbook.ods', 'rb') as f:
    sheet = odio.parse_spreadsheet(f)
    print(*sheet.tables[0].rows, sep='\n')

This will correctly generate a logbook.ods file, then open it in libreoffice calc and save it.
Now load the file with odio again:

with open('logbook.ods', 'rb') as f:
    sheet = odio.parse_spreadsheet(f)
    print(*sheet.tables[0].rows, sep='\n')

logbook.csv

@rnhmjoj , thanks for the bug report, I've managed to reproduce it by following your steps. I'll see if I can fix it.

I've fixed this and done a new release, 0.0.17. I'll close this issue, but please re-open it if the fix doesn't work.

Thank you. I will try it soon.