Org mode spreadsheet programmatic remote references

emacs, org-mode, remoteobject, spreadsheet

Solution

Yes, you can't do this with built-in `remote` and you need to use `org-table-get-remote-range`. Hopefully this better suits your needs than the answer given by artscan (I used his/her example):

| testname1 | testname2 |
|-----------+-----------|
|         1 |         2 |
#+TBLFM: @2='(org-table-get-remote-range @<$0 (string ?@ ?1 ?$ ?1))

#+TBLNAME: testname1
|    1 |

#+TBLNAME: testname2
|    2 |

Note the `(string ?@ ?1 ?$ ?1)`: this is necessary because before evaluating table formulae, all substitutions will be done first. If you use `"@1$1"` directly, it would have triggered the substitution mechanism and be substituted by the contents of the first cell in this table.

Problem

I keep my budget in org-mode and have been pleased with how simple it is. The simplicity fails, however, as I am performing formulas on many cells; for instance, my year summary table that performs the same grab-and-calculate formulas for each month. I end up with a massive line in my +TBLFM. This would be dramatically shorter if I could programmatically pass arguments to the formula. I'm looking for something like this, but working: ``` | SEPT | | #ERROR | #+TBLFM: @2$1=remote(@1,$tf) ``` Elsewhere I have a table named SEPT and it has field named "tf". This function works if I replace "@1" with "SEPT" but this would cause me to need a new entry in the formula for every column. Is there a way to get this working, where the table itself can specify what remote table to call (such as the SEPT in my example)?

Original source