A nice tip from John Kitchen on the org-mode mailing list. I would like to be able to export several org-mode tables to a csv file without having to visit each table in the buffer and export it manually.

Try this:

#+name: mytable
| a | b |
| 1 | 2 |
| 3 | 4 |
#+BEGIN_SRC emacs-lisp
(save-excursion
(org-open-link-from-string "[[mytable]]")
 (while (not (org-table-p)) (forward-line))
 (org-table-export "mytable.csv" "orgtbl-to-csv"))
#+END_SRC
#+RESULTS:
Export done.
#+BEGIN_SRC sh
cat mytable.csv
#+END_SRC
#+RESULTS:
a,b
1,2
3,4

Comments

comments powered by Disqus