Libary "tablib" manipulates imported CSV data

29 Views Asked by At

Using https://tablib.readthedocs.io/en/stable/api.html#tablib.Dataset.load possibly missing columns will be added automatically as empty string:

                if i > 0 and len(row) < dset.width:
                    row += [''] * (dset.width - len(row))

It seems to be impossible to prevent this behaviour.

So how to check the number of provided data columns for each row after load() in case of an invalid CSV file?

Example with header:

header1;header2;header3
data1;data2
0

There are 0 best solutions below