I'm trying to process tens of tables (from multiple org-files) in python src-block at once.
Suppose that the following file: /tmp/file1.org
contains some tables:
* This org contains the tables
#+name: table_example_1
| 1 | 2 | 3 |
| 4 | 5 | 5 |
#+name: table_example_2
| a | b | c |
| d | e | f |
#+name: table_example_3
| a1 | b2 | c3 |
| d4 | e5 | f6 |
AFAIK (to use all tables from previous org-file), I have the following two methods:
* method 1
#+BEGIN_SRC python :results output :var tbl1=/tmp/file1.org:table_example_1 tbl2=/tmp/file1.org:table_example_2 tbl3=/tmp/file1.org:table_example_3
print(tbl1)
print(tbl2)
print(tbl3)
#+END_SRC
#+RESULTS:
: [[1, 2, 3], [4, 5, 5]]
: [['a', 'b', 'c'], ['d', 'e', 'f']]
: [['a1', 'b2', 'c3'], ['d4', 'e5', 'f6']]
-----------------------------------------------------------------------------------------------------------------------------------------------
* method 2
:PROPERTIES:
:header-args: :var tbl1=/tmp/file1.org:table_example_1 tbl2=/tmp/file1.org:table_example_2 tbl3=/tmp/file1.org:table_example_3
:END:
#+BEGIN_SRC python :results output
print(">", tbl1)
print(">", tbl2)
print(">", tbl3)
#+END_SRC
#+RESULTS:
: > [[1, 2, 3], [4, 5, 5]]
: > [['a', 'b', 'c'], ['d', 'e', 'f']]
: > [['a1', 'b2', 'c3'], ['d4', 'e5', 'f6']]
Problem: You can see that lines #+BEGIN_SRC python ....
and :header-args: ...
are very long. Now imagine, there are 20-30 tables. It's quite annoying to manage this long line.
Question:
- Is it possible to divide these too long
header-arguments
into multiple lines to make it easy to manage? - Or is there an easier method to achieve what I'm doing?
org-table-export
and read the csv from Python.