emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Joost Helberg <joost@snow.nl>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-export to Spreadsheet
Date: Thu, 23 Aug 2012 16:29:30 +0530	[thread overview]
Message-ID: <876289lvql.fsf@gmail.com> (raw)
In-Reply-To: <20120823.103426.2236953666490845835.joost@snow.nl> (Joost Helberg's message of "Thu, 23 Aug 2012 10:34:26 +0200 (CEST)")

Joost Helberg <joost@snow.nl> writes:

> ls,
>
> org-export-odt-preferred-output-format doesn't support ods or xlsx. 
> Libreoffice is incapable of converting odt to ods, which is the main
> reason, as far as I can see, for org-export-odt to not deliver this
> service. 

LibreOffice is a collection of document classes - Writer is a "Text
document", Calc is a "Spreadsheet document" and Impress is a
"Presentation document".

LibreOffice provides filters - in common man's terms, what you with
"Save as" - from one format to another within the *same* document class
but *not* *across* document classes.

For example, you can move between "doc" file and "odt" file because both
are text documents.  You can move between "csv" and "ods" because both
are spreadsheet documents.  But you cannot move between odt and ods
because you are moving between text document to spreadsheet document.

This is exactly the reason why, when you do

    M-x customize-variable RET org-export-odt-preferred-format RET

you will see only "Text formats" like doc etc in the drop down list and
not xls or ods.

> After exporting my calldata reports to odt, I end up `selecting
> all' in libreoffice, creating a new spreadsheet and pasting all into
> this new spreadsheet. Of course, as a org-mode user, I hate all this
> interaction with GUI programs.

The trick is to use M-x org-table-export RET to export a org-table to
csv format and then convert that csv file to ods format.

For the sake of illustration, 

1. Install below function

    (defun org-export-to-ods ()
      (interactive)
      (let ((csv-file "data.csv"))
        (org-table-export csv-file "orgtbl-to-csv")
        (org-export-odt-convert csv-file "ods" 'open)))

2. Put your cursor on a table

3. Do M-x org-export-to-ods

You will see that the table is exported to a spreadsheet and it is
opened.

TIP:

1. You can replace "csv" to "tsv".
2. You can replace "ods" with "xls" or "xlsx"
3. You will get a spreadsheet but not any of the meta-data transferred.
   For example, no transference of TBLFM lines or recognition of
   spreadsheet fields like number, date etc.
4. LibreOffice's command line converter - this I suppose being new - has
   some issues if LibreOffice application is already running.  So if you
   are exporting multiple tables you can replace 'open in the above
   function with nil.

> I was wondering whether there is a better way to do this, or if a
> minor add-on would facilitate this (C-c C-e s|S maybe?).

There was a prior request to convert org-tables to LibreOffice Calc
directly - so that some TBLFM lines could be transferred.  But this
cannot be done in a day or two and requires more efforts (and may
necessitate improvement of org-element/org-export infrastructure)

> regards,
>
> Joost

-- 

  reply	other threads:[~2012-08-23 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23  8:34 org-export to Spreadsheet Joost Helberg
2012-08-23 10:59 ` Jambunathan K [this message]
2012-08-23 15:55   ` Joost Helberg

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=876289lvql.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=joost@snow.nl \
    /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).