Merge orgmode tables vertically

898 views Asked by At

Is it possible to append a table below another? I am looking for something like this but in the following form:

#+name: tbl1
| a | 1 |
| b | 2 |
#+name: tbl2
| c | 3 |
| d | 4 |

I am expecting to get this:

| a | 1 |
| b | 2 |
| c | 3 |
| d | 4 |

From my search I found lob-tables-operations but it seems to me that it's not well documented and likely not under maintenance.

1

There are 1 answers

0
owblique On BEST ANSWER

It was quite straight forward based on this example. I just used of mapcan instead of mapcar

** append tables
   :PROPERTIES:
   :DATE:     2015-06-19
   :END:
#+name: table-names
- first-table
- second-table
- third-table

#+name: first-table
| a | 1 |
| b | 2 |
|---+---|

#+name: second-table
| c | 3 |
| d | 4 |
|---+---|

#+name: third-table
| f | 5 |
| g | 6 |
|---+---|


#+BEGIN_SRC emacs-lisp :var table-names=table-names
(mapcan #'org-babel-ref-resolve table-names)
#+END_SRC

#+RESULTS:
| a | 1 |
| b | 2 |
|---+---|
| c | 3 |
| d | 4 |
|---+---|
| f | 5 |
| g | 6 |
|---+---|