emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: Use babel to import table data from OpenDocument spreadsheets?
Date: Wed, 10 Jul 2013 23:31:06 +0200	[thread overview]
Message-ID: <87d2qqrtk5.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: 87ip0j5f8q.wl%jamshark70@dewdrop-world.net

Hi James,

James Harkins <jamshark70@gmail.com> writes:

> At Wed, 03 Jul 2013 10:35:51 +0800,
> James Harkins wrote:
>> Anyway, I'm not convinced that org-odt-convert would meet my needs
>> anyway. It will have to be a multi-worksheet file, and I'll have to
>> extract just one or two of the worksheets. The macro might be the
>> way to go.
>
> I've made a bit more progress with this. I found a utility,
> unoconv[1], which I can persuade to produce a tab-separated export of
> the first worksheet of an ODS document. That much should work for my
> needs -- I can reserve the first worksheet for the data to be
> published, and put all the calculations in other sheets.
>
> I'm not sure how to import this as an org table. I found
> org-table-import, but it seems that this must insert a table into a
> buffer and then convert to org-table format in the buffer. I don't
> know how to integrate that with babel. If I set ":exports results,"
> should I assume then that the code block should return a string
> consisting of the org-formatted table?
>
> - Or, do I have to say ":exports none" and do some save-excursion
> magic with moving the point to the right place before calling
> org-table-import? (That's probably okay for this small-scale usage,
> but it would be slicker to put a #+CALL in the right location.)
>
> - Or, do I have to write my own lisp function to format the table as a string?
>
> The goal is that I should be able to do C-c C-e h h from the org
> document, and babel will run a short emacs-lisp block to invoke
> unoconv (producing a CSV file on disk) and then insert the table under
> the right heading.
>
> Thanks,
> hjh
>
> [1] http://linux.die.net/man/1/unoconv

I did not follow the thread, but reading ods files into org is easy, if
you have access to R:

--8<---------------cut here---------------start------------->8---
#+name: firstsheet
#+begin_src R :colnames yes
  library("ROpenOffice")
  read.ods("~/tmp/not.ods")[[1]]
#+end_src

#+results: firstsheet
| first col | second col | third col |
|-----------+------------+-----------|
|         8 |          4 |         5 |
|      1541 |         79 |       628 |


#+name: secondsheet
#+begin_src R :colnames yes
  library("ROpenOffice")
  read.ods("~/tmp/not.ods")[[2]]
#+end_src

#+results: secondsheet
| dtr   | egd   | pdrn |
|-------+-------+------|
| ugn   | apggh | gpd  |
| ulgnd | pugn  | pdsg |
--8<---------------cut here---------------end--------------->8---

Regards,
Andreas

      parent reply	other threads:[~2013-07-10 21:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 14:10 Use babel to import table data from OpenDocument spreadsheets? James Harkins
2013-07-02 14:19 ` Jambunathan K
2013-07-02 14:30   ` James Harkins
2013-07-02 15:10     ` Jambunathan K
2013-07-03  2:35       ` James Harkins
2013-07-03  3:05         ` Jambunathan K
2013-07-10  2:19         ` James Harkins
2013-07-10  3:50           ` Jambunathan K
2013-07-18  1:28             ` James Harkins
2013-07-18  9:19               ` Jambunathan K
2013-07-18 15:42                 ` James Harkins
2013-07-18 19:02                   ` Jambunathan K
2013-07-18 19:05                     ` Jambunathan K
2013-07-18 21:32                     ` James Harkins
2013-07-10 21:31           ` Andreas Leha [this message]

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=87d2qqrtk5.fsf@med.uni-goettingen.de \
    --to=andreas.leha@med.uni-goettingen.de \
    --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).