coddingtonbear / obsidian-csv-table

Have a CSV file you want to render some or all of the data from? This plugin allows you to display that data in your obsidian preview.
MIT License
113 stars 5 forks source link

export from Outlook gives error when trying to read #12

Closed pcause closed 2 years ago

pcause commented 2 years ago

I export my contacts from outlook to a csv. When the plugin tries to read it gives an error because the header has 96 fields and a record has less. It is not illegal to have a short line in a csv. It means to treat the rest of the fields are empty.

coddingtonbear commented 2 years ago

The challenge with CSV is that what "legal" is is up for debate -- there's no RFC to point at; no standards body making any kind of decisions about it -- and clearly the particular library this plugin uses (csv-parse: https://csv.js.org/parse/) has a different idea of legality than your version of Outlook.

I agree, though, that it does suck that the parser out-of-the-box demands that all columns be provided for each row. There's good news, though, I did just briefly glance at their docs (which are linked from the csvOptions option in the readme) and they do have a parsing option that might work for your particular use case: https://csv.js.org/parse/options/relax_column_count/. The readme gives instructions for how you might provide such an option when parsing your particular CSV file.

Cheers & good luck.