emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tbanelwebmin <tbanelwebmin@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: join tables from different files
Date: Sun, 7 Jun 2020 08:33:39 +0200	[thread overview]
Message-ID: <dcb93108-67f8-df93-46b9-1ca54fe8f90d@free.fr> (raw)
In-Reply-To: <878sh0q66c.fsf@mat.ucm.es>

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	other threads:[~2020-06-07  6:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-06 20:40 join tables from different files Uwe Brauer
2020-06-07  6:33 ` tbanelwebmin [this message]
2020-06-07 15:09   ` [join rows] (was: join tables from different files) Uwe Brauer
2020-06-08  6:18     ` tbanelwebmin
2020-06-08  9:41       ` Jude DaShiell
2020-06-08 11:09         ` [join rows] Uwe Brauer
2020-06-08 11:30           ` tomas
2020-06-08 13:55           ` Jude DaShiell
2020-06-08 18:37             ` Uwe Brauer
2020-06-08 11:08       ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcb93108-67f8-df93-46b9-1ca54fe8f90d@free.fr \
    --to=tbanelwebmin@free.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).