aniav / ynab-csv

Tool for making your CSV files ready to import into YNAB
https://aniav.github.io/ynab-csv/
MIT License
164 stars 84 forks source link

Csv delim #29

Closed pedralmeida closed 4 years ago

pedralmeida commented 4 years ago

Allow the choice of a delimiter character when exported CSVs do not use comma as separator.

aniav commented 4 years ago

Thank you for the PR @pedralmeida. I will check this within the next week as I am currently traveling 🙌

aniav commented 4 years ago

So I think I need a bit more context here. Papa.parse has the possibility of automatic delimiter detection and uses each of the list of [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP], which covers more cases than your implementation.

From their docs: https://www.papaparse.com/docs#config

Is this not enough for your use case?

pedralmeida commented 4 years ago

Hi!

Thank you for looking into it. Yes, Papa.parse has an automatic way to detect it. However for non-american countries that use the seicolon as separator, the comma is then used as decimal delimiter and papaparse interpreted that as the delimiter. So I required a new method to force the separator so it is not fooled.

eg: field;field;3,5;field;field

in this example, papaparse separates the 3,5 creating field;field;3 and

I believe you can test this by simply manipulating a typical csv and change all commas by semicolons and vice-versa.

Ania Warzecha notifications@github.com escreveu no dia segunda, 17/02/2020 à(s) 15:35:

So I think I need a bit more context here. Papa.parse has the possibility of automatic delimiter detection and uses each of the list of [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP].

From their docs: https://www.papaparse.com/docs#config

Is this not enough for your use case?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aniav/ynab-csv/pull/29?email_source=notifications&email_token=AIEXEZQQWT2IPPZ5OZONU33RDKVDZA5CNFSM4KTPASC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL62OHA#issuecomment-587048732, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIEXEZXFTANBP5ILKZFEG4TRDKVDZANCNFSM4KTPASCQ .