From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: from org-table (with formulas) to csv and back (ods)
Date: Tue, 12 Jul 2022 09:52:00 +0200 [thread overview]
Message-ID: <87h73mrcnz.fsf@mat.ucm.es> (raw)
Hi
As it was pointed out to me in
https://github.com/kjambunathan/org-mode-ox-odt/issues/94
It is possible to start with a ods file then convert it to csv with
formula to obtain something like this
#+begin_src
3,6,"=SUM($A1:$B1)"
1,3,"=SUM($A2:$B2)"
1,2,"=SUM($A3:$B3)"
#+end_src
That can be relatively converted to a org-table with the correct formula
#+begin_src
| First | | |
|-------+---+-----|
| 3 | 6 | 9 |
| 1 | 3 | 4 |
| 1 | 2 | 3 |
| 8 | 9 | 17 |
,#+TBLFM: $3=vsum($1..$2);f-2
#+end_src
And furthermore modified.
#+begin_src
| First | | |
|-------+---+-----|
| 3 | 6 | 9 |
| 1 | 3 | 4 |
| 1 | 2 | 3 |
| 8 | 9 | 17 |
| 100 | 1 | 101 |
,#+TBLFM: $3=vsum($1..$2);f-2
#+end_src
The question is how to convert back to csv?
Manually the «correct table» would be
#+begin_src
| 3 | 6 | =SUM($A1:$B1) |
| 1 | 3 | =SUM($A2:$B2) |
| 1 | 2 | =SUM($A3:$B3) |
| 100 | 1 | =SUM($A4:$B4) |
#+end_src
Which will then be converted to
#+begin_src
3,6,=SUM($A1:$B1)
1,3,=SUM($A2:$B2)
1,2,=SUM($A3:$B3)
100,1,=SUM($A4:$B4)
#+end_src
So the question is: at least for simple formulas (no ifs for example)
wouldn't it be good to implement a lisp function that does this conversion?
regards
Uwe Brauer
--
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
reply other threads:[~2022-07-12 8:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87h73mrcnz.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--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).