bhima icon indicating copy to clipboard operation
bhima copied to clipboard

Allow CSV imports to handle comma or tab separators

Open jmcameron opened this issue 7 months ago • 0 comments

By default, util.formatCsvToJson(file) parses for commas. However, Excel will generate "CSV" files with commas (for English-based locales), but will generate "CSV" files (by default) with tabs in French-based locals. This is very confusing to inexperienced Excel users in Congo who use Excel to edit/create CSV files.

The suggestion in this issue is to fix the problem by

  1. include a "Tab" or "Comma" checkbox on all import dialogs that are used to select files for importing CSV files, default it to comma, but allow the user to choose tabs. This will require modifying the utils.formatCsvToJson() function to accept an optional second argument for the desired delimiter.
  2. Add better error handling and an error message that explains the the user may need to convert tabs to commas in their input file (and first change commas to decimals).

Reference https://github.com/IMA-WorldHealth/bhima/issues/4296

jmcameron avatar Jul 15 '24 10:07 jmcameron