From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: Use babel to import table data from OpenDocument spreadsheets? Date: Fri, 19 Jul 2013 00:35:02 +0530 Message-ID: <87mwpjzo2p.fsf@gmail.com> References: <87k3l9kq78.wl%jamshark70@dewdrop-world.net> <878v1pvybk.fsf@gmail.com> <87y59p591f.wl%jamshark70@dewdrop-world.net> <87y59p80b3.fsf@gmail.com> <87vc4s5q0o.wl%jamshark70@dewdrop-world.net> <87ip0j5f8q.wl%jamshark70@dewdrop-world.net> <87a9lv9ipq.fsf@gmail.com> <874nbszmfw.wl%jamshark70@dewdrop-world.net> <87a9lkns2z.fsf@gmail.com> <8738rbzxgn.wl%jamshark70@dewdrop-world.net> <87r4evzo6j.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UztUD-0006VD-7M for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 15:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UztUC-0007Dd-3r for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 15:03:33 -0400 Received: from mail-pd0-x234.google.com ([2607:f8b0:400e:c02::234]:42144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UztUB-0007DX-U1 for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 15:03:32 -0400 Received: by mail-pd0-f180.google.com with SMTP id 10so3360040pdi.39 for ; Thu, 18 Jul 2013 12:03:31 -0700 (PDT) In-Reply-To: <87r4evzo6j.fsf@gmail.com> (Jambunathan K.'s message of "Fri, 19 Jul 2013 00:32:44 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: James Harkins Cc: orgmode Jambunathan K writes: > I don't want to venture in to Babel. > > I don't want to experiment with unoconv either. I have a non-official > libreoffice installed. Pulling in official unoconv will interfere with > my working installation. > > For your purposes, just soffice will do. > > > (defun org-table-import-ods (&optional file-name) > (interactive "fFile: ") > (let ((csv-file (org-odt-convert file-name "csv")) > (pos (point))) > (save-excursion > (insert (with-temp-buffer > (insert-file-contents csv-file) > (org-table-convert-region (point-min) (point-max) '(4)) > (buffer-string)))))) > > | Simple | Table | > | 1 | 10 | > | 2 | 20 | > | 3 | 30 | > > > Remember to close all libreoffice applications. THIS IS IMPORTANT. > Otherwise `org-odt-convert' will error out. > > 0. Visit scratch buffer > 1. Install the above snippet > 2. Go to end of the scratch buffer. > 3. M-x org-table-import-ods RET > > You will see something like what I see above. Here is a dump from my Messages buffer. ,---- | Executing libreoffice4.0 --headless --convert-to csv --outdir ~/ ~/html-table.ods | convert ~/html-table.ods -> ~//html-table.csv using Text - txt - csv (StarCalc) | | Exported to ~/html-table.csv | Undo! | Executing libreoffice4.0 --headless --convert-to csv --outdir ~/ ~/html-table.ods | convert ~/html-table.ods -> ~//html-table.csv using Text - txt - csv (StarCalc) | | Exported to ~/html-table.csv `---- > > James Harkins writes: > >> At Thu, 18 Jul 2013 14:49:16 +0530, >> Jambunathan K wrote: >>> 1. Give me a sample worksheet. >> >> Attached. >> >>> 2. Give me the specific unoconv command that you used for converting the >>> worksheet. >> >> unoconv -f csv -i 9,34,system,1,1/5/2/1/3/1/4/1 html-table.ods >> >> Maybe the filename needs a full path, not sure. I can supply that later. >> >>> If you do (1) and (2), I will post a recipe. >> >> Really appreciate that! >> >> hjh