awdeorio / mailmerge

A simple, command line mail merge tool.
MIT License
140 stars 41 forks source link

Support CSV files with semicolons as separators #146

Closed abtsousa closed 1 year ago

abtsousa commented 1 year ago

This project is amazing. However, due to my regional settings, CSV files are saved as semicolons instead of commas (which are used for decimals).

Is there a way you could add support to these? I'm tired of having to use find-replace for the script to work.

seshrs commented 1 year ago

Hi, thanks for the suggestion! Python makes this really easy to implement, we could just accept a delimiter string as a CLI option and add a delimiter variable here: https://github.com/awdeorio/mailmerge/blob/76b5d55a59563863fe5517d34d065c07de5b2b88/mailmerge/__main__.py#L270-L273

Even better, we could use the Sniffer class to automatically attempt to detect the right settings for reading the CSV file. If this works for your use-case, I think this is the cleaner solution since we would not need to add a new CLI option.

Would you like to try opening a PR with this changes? Let us know here if you need support getting started :)

abtsousa commented 1 year ago

Would you like to try opening a PR with this changes? Let us know here if you need support getting started :)

Thanks for your help, I was actually looking into that as you commented. Would this #147 work? I'm a novice Python programmer so I apologize if my syntax is unorthodox, but it seems to be working right on my end.

awdeorio commented 1 year ago

I really like the Sniffer idea! I'll take a look at your PR soon.