Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orgtre/csvorg
Export/import Emacs Org mode entries to/from csv-files
https://github.com/orgtre/csvorg
csv csv-export csv-import emacs org-mode
Last synced: 2 days ago
JSON representation
Export/import Emacs Org mode entries to/from csv-files
- Host: GitHub
- URL: https://github.com/orgtre/csvorg
- Owner: orgtre
- Created: 2023-01-07T12:46:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T18:39:16.000Z (about 2 years ago)
- Last Synced: 2024-11-29T09:14:39.437Z (2 months ago)
- Topics: csv, csv-export, csv-import, emacs, org-mode
- Language: Emacs Lisp
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* csvorg
This [[https://www.gnu.org/savannah-checkouts/gnu/emacs/emacs.html][Emacs]] package lets you convert a set of [[https://orgmode.org][org-mode]] entries to a csv-file and the other way around. It extends and complements similar functionality provided by a combination of the built-in [[https://orgmode.org/worg/org-contrib/org-collector.html][org-collector]] and [[https://orgmode.org/manual/Built_002din-Table-Editor.html][org-table]], or the external package [[https://github.com/jplindstrom/emacs-org-transform-tree-table][emacs-org-transform-tree-table]]. The [[https://github.com/mhayashi1120/Emacs-pcsv][pcsv]] package is used as csv-parser when importing and =org-map-entries= is used to collect entries when exporting.
** Usage
Two commands are provided: =csvorg-export= and =csvorg-import=. They can be used interactively, but to access all options non-interactive use is required. Their docstring explains how to use them.
*** Example
#+begin_src elisp
(csvorg-export
"csvorg-test-from-org.csv" nil
'("ITEM" "prop1" "prop0" "TODO" "TAGS" "child1")
"LEVEL=2" '("csvorg-test.org") t t)
#+end_srcfor a file /csvorg-test.org/ with content:
#+begin_src
* entries
:PROPERTIES:
:prop0: value of prop0
:END:** head1
:PROPERTIES:
:prop1: value of head1prop1
:END:*** child1
content of head1child1
** DONE head2 :tag1:tag2:
:PROPERTIES:
:prop1: value of head2prop1, with comma
:prop2: value of head2prop2
:END:*** child1
content of head2child1, with comma
and linebreaks
*** child2
content of head2child2
#+end_srcwill create the file /csvorg-test-from-org.csv/ with content:
#+begin_src
ITEM , prop1 , prop0 , TODO, TAGS , child1
head1, value of head1prop1 , value of prop0, , , content of head1child1
head2, "value of head2prop1, with comma", value of prop0, DONE, :tag1:tag2:, "content of head2child1, with comma\n\nand linebreaks"
#+end_srcwhere the spaces between fields are only inserted here for display purposes.
#+begin_src elisp
(csvorg-import
"csvorg-test-from-org.csv"
"csvorg-test-from-org-and-back.org"
nil '("prop1" "prop0" "TODO" "TAGS")
'("child1") "entries")
#+end_srcnow imports this csv-file into org by creating the file /csvorg-test-from-org-and-back.org/ with contents:
#+begin_src
* entries** head1
:PROPERTIES:
:prop1: value of head1prop1
:prop0: value of prop0
:END:*** child1
content of head1child1
** head2
:PROPERTIES:
:prop1: value of head2prop1, with comma
:prop0: value of prop0
:'TODO: DONE
:'TAGS: :tag1:tag2:
:END:*** child1
content of head2child1, with comma
and linebreaks
#+end_srcNote the following:
- All Org entries user properties, special properties, and children (subheadings with contents) can be exported.
- To determine entries for export, the flexible [[https://orgmode.org/manual/Matching-tags-and-properties.html][match]] and scope arguments of =org-map-entries= can be used.
- On import the Org entry heading can be constructed using an arbitrary function of the corresponding csv row and the column names, with sensible defaults.
- Hooks are provided for transforming column names on import, and field values on import and export, again with sensible defaults.
- If all entries user properties and children are exported, no special properties are used except ITEM, property inheritance is disabled, entries contain no extra leading or trailing whitespace, and all exported entries are children of the same parent, then one gets back the same thing after an export and import.