I want to copy the values of a shifted range of cells from a remote table.
Example:
#+NAME: TBL1
| 1 | 2 | 3 | 4 |
| | | | |
#+NAME: TBL2
| | 5 | 6 | 7 | 8 |
| | | | | |
The table TBL1 should look like this in the end:
#+NAME: TBL1
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
I'm currently doing this with a dedicated function for each of 15+ cells, which makes the #+TBLFM:
line super long and is not maintainable.
An efficient way to accomplish this is by using the lisp function identity
:
#+NAME: TBL1
| 1 | 2 | 3 | 4 |
| | 5 | 6 | 7 |
#+TBLFM: @2$1..@2$4='(identity remote(TBL2, @1$$#))
Problem is, that this function looks for values in the cells @1$1..@1$4
. I want to shift the cells to look at to the right (@1$2..@1$5
).
This has to be done via the REF value for the remote function, (@1$$#
).
If I understand the syntax correctly, $$#
is pointing to the current column of the cell which is going to be filled with the remote value (e.g. for cell @2$1
in TBL1
, $$#
becomes $1
). So this has to be shifted to the right with something like $$#+1
.
What is the correct reference for my example?
@1$$#
with(format "@1$%d" (+ 1 $#))
work? I’m away from emacs at moment so I can’t test syntax.@2
ofTBL1
blank. No error notification. I also checked(format "@1$%d" 2)
which should format the string@1$2
and result in| 5 | 5 | 5 | 5 |
for@2
ofTBL1
, but@2
stays also empty. Therefore usingformat
might not work in general.