emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: join tables from different files


From: tbanelwebmin
Subject: Re: join tables from different files
Date: Sun, 7 Jun 2020 08:33:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Yes you can.
Use an org-id

Suppose you have a table in file x.org, under some title:

--------- x.org ----------------------
* title

| a  |  b |
|----+----|
| aa |  5 |
| bb |  7 |
| aa | 11 |
--------------------------------------


Add an ID by calling: M-x org-id-get-create. You end up with:

--------- x.org ----------------------
* title
  :PROPERTIES:
  :ID:       c8b8bb22-e42e-426f-afb0-4cb19aed27ad
  :END:

| a  |  b |
|----+----|
| aa |  5 |
| bb |  7 |
| aa | 11 |
--------------------------------------

Globally save the new ID by calling M-: (org-id-locations-save). You will see 
c8b8bb22-e42e-426f-afb0-4cb19aed27ad in the ~/.emacs.d/.org-id-locations file.


In another file, say y.org, you may now reference this remote table with the ID 
in an aggregated, transposed, or joined block:

--------- y.org ----------------------
#+BEGIN: aggregate :table "c8b8bb22-e42e-426f-afb0-4cb19aed27ad" :cols "a 
vsum(b)"
| a  | vsum(b) |
|----+---------|
| aa |      16 |
| bb |       7 |
#+END:
--------------------------------------

The wizard for creating the aggregated (or joined, or transposed) block does 
not (yet) complete remote tables names, only buffer-local ones. The wizard may 
be called with C-c C-x x (or C-x C-x i on older versions of Org Mode).


Note that those global IDs are also used by the spreadsheet remote() function. 
Example:

--------- z.org ----------------------
|  b |
|  5 |
|  7 |
| 11 |
#+TBLFM: $1=remote(c8b8bb22-e42e-426f-afb0-4cb19aed27ad,@@#$2)
--------------------------------------


Have fun
Thierry

Le 06/06/2020 à 22:40, Uwe Brauer a écrit :

> Hi 
>
> I know I can either user 
> (org-insert-dblock:aggregate)
> (org-insert-dblock:join)
>
> To join or aggregate tables with in the same files. 
>
> But can  I join tables from different files?
>
> Thanks
>
> Uwe Brauer 
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]