From 5b5bf879765e7a3d52ffffdc3fb3eb8c7d5d404f Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 5 May 2019 15:54:16 +0200 Subject: [PATCH] [Utils] Small helper function to open CSV files as Org mode tables --- site-lisp/db-utils.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index d436a46..82ff474 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -410,6 +410,17 @@ path." (replace-match "\\1CLOCK: [\\4]--[\\3]") (org-clock-update-time-maybe))))) +(defun db/find-csv-in-org (arg) + "Interactively CSV find file and open it as Org mode table. +Default separator is \";\", but this can be changed interactively +by passing a universal argument." + (interactive "P") + (let ((separator (if arg (read-from-minibuffer "Separator (regular expression): ") + ";"))) + (call-interactively #'find-file) + (org-mode) + (org-table-convert-region (point-min) (point-max) separator))) + ;;; Calendar