1

How can I export all the tables in org-mode file similar to that.

* May
:PROPERTIES:
:TABLE_EXPORT_FILE: ~/Desktop/may.csv
:TABLE_EXPORT_FORMAT: orgtbl-to-csv
:END:

|One|Two|
|---+---|

* June
:PROPERTIES:
:TABLE_EXPORT_FILE: ~/Desktop/june.csv
:TABLE_EXPORT_FORMAT: orgtbl-to-csv
:END:

|One|Two|
|---+---|

I want to run something like this to export all tables to the defined file.

emacs --batch table.org  --eval 'org-table-export'

The problem is that I have to be in the table.

1 Answer 1

4

You can use org-table-map-tables for iterating over the tables of an Org file.

Example for the Shell command:

emacs --batch table.org  --eval '(org-table-map-tables (quote org-table-export))'

You should give the file names for the exported tables and the export format in the org file like that:

* First Section
:PROPERTIES:
:TABLE_EXPORT_FILE: first.csv
:TABLE_EXPORT_FORMAT: orgtbl-to-csv
:END:
| header 1 | header 2 |
|----------+----------|
|      1.1 |      1.2 |
|      2.1 |      2.2 |

* Second Section
:PROPERTIES:
:TABLE_EXPORT_FILE: second.csv
:TABLE_EXPORT_FORMAT: orgtbl-to-csv
:END:

| 2nd header 1 | 2nd header 2 |
|--------------+--------------|
|         21.1 |         21.2 |
|         22.1 |         22.2 |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.