From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EEHXE5MszWLE+gAAbAwnHQ (envelope-from ) for ; Tue, 12 Jul 2022 10:10:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YKvRE5MszWKgIwAA9RJhRA (envelope-from ) for ; Tue, 12 Jul 2022 10:10:59 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D49B7296ED for ; Tue, 12 Jul 2022 10:10:57 +0200 (CEST) Received: from localhost ([::1]:60130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBAyt-0005rt-NB for larch@yhetil.org; Tue, 12 Jul 2022 04:10:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBAgm-0005FL-Kj for emacs-orgmode@gnu.org; Tue, 12 Jul 2022 03:52:12 -0400 Received: from ciao.gmane.io ([116.202.254.214]:44222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBAgk-0001aV-Oh for emacs-orgmode@gnu.org; Tue, 12 Jul 2022 03:52:12 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1oBAgh-0004jU-Un for emacs-orgmode@gnu.org; Tue, 12 Jul 2022 09:52:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-orgmode@gnu.org To: emacs-orgmode@gnu.org From: Uwe Brauer Subject: from org-table (with formulas) to csv and back (ods) Date: Tue, 12 Jul 2022 09:52:00 +0200 Message-ID: <87h73mrcnz.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:dDeDCgGswoa+18rICkFeAfsPk6g= Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657613458; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cXAIDIR3IeX42AAjP1SE9DWN6+/fCzWYcx7i+HA3Yz0=; b=jcLj1qO+GcpY5xxQUnXJcCI27YZ/Gylsjwx/+qP6iutb7z7rn5n+v34Vd33uoYTcdmhA9y 8JdXKqJPKtzGZrSpsUhuSIptL0t42vHlmHuYv2nL2rLG4qfDIdAOwodM8eLRVMiRGoXbX6 PSlGxpuk3L2l8LGA0wf7KystmY1m0b9WEyu8aQO4QTw8BR/S6zTTQ0tOb3lC5kP2Pmue8B VlLVuXrujCja8LSfdhdtofx0Bzc9ClxcLVIA3jwQBKhGI2py7bHDQT43mlXqq9SMTFYgLV UkyWyJvY9QjxNgrcC2bP6H7/599K1YcO+qADmY3RcYK/AInYABsfDZ9i+UYN7w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657613458; a=rsa-sha256; cv=none; b=VaPnNL8F6e8/MveI/7XUeqhT8LRjFTSM6aMyiIXStAcU3u5HHevJT00rFhctSBxBSTHX2x vjkIGdOcaaixObMoy6AwBRsWtyCxvlkf2Le8ZlhSPEGFmEIro+y5cVJxoHMPJnmiICNY8L y2i8HZ7nkC7jA10kMIfxLmdNBhb7MypxdEw7H3pU3j4f7+KYf6nvlcnk0sf+QQy8kyYJmU +tkAQpuYUISK8ZkJ8iagNPyr5ld/L+oG2aKQcxpdYIRqwEttIJgxnfdq+eSI0fIm5z7GAI FqV8zn0ryc+7QqUEOf2uKdExDE+2Kweke6ErzH88e+pMKOn50a6dJJ/5gbvsVQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=mat.ucm.es (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 2.75 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=mat.ucm.es (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D49B7296ED X-Spam-Score: 2.75 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6WkyP/djIB9d 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.