Hi Maxim, Sorry for the late reply!
On 2021-04-28, 23:38 +0700, Maxim Nikulin <maniku...@gmail.com> wrote: > On 28/04/2021 15:37, Utkarsh Singh wrote: >> +List of preferred separator (in order of preference): >> +comma, TAB, semicolon, colon or SPACE. > I will hardly be using this feature heavily, so I do not insist that > the following must be taken into account. Just some considerations... > > There are locales where comma is used as decimal separator 23,5 > (e.g. ru_RU.UTF-8). Office software and applications oriented to > office users often use semicolon as field separator. There are still > may be plenty of numbers with fractional part, so with commas. Likely > ";" should be tried at first for such locales. > > However the same user may have enough CSV files that are really "comma > separated", e.g. results of numerical simulation where localization is > intentionally ignored, data obtained from some equipment, etc. > > Some files (e.g. downloaded bank statements) may be in legacy 8-bit > encoding instead of UTF-8. > > As a result, sometimes the only convenient way is to try various > options with interactive preview. What do we mean by interactive preview? Does this mean that we should present a user with a list of possible delimiters using minibuffer? If you are suggesting this then rather trying 'various options' based on locals you can use =org-table-import= function directly as it accepts separator as it's argument. For ex (please review my usage of alist): #+begin_src elisp (defvar my-separator-alist '(("comma" . ",") ("tab" . "\t") ("semicolon" . ";") ("colon" . ":") ("space" . " "))) (defun my/table-import (file separator) (interactive (list (read-file-name "Import CSV file: " nil nil t) (cdr (assoc (completing-read "Separator: " my-separator-alist) my-separator-alist)))) (org-table-import file separator)) #+end_src -- Utkarsh Singh http://utkarshsingh.xyz