emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-export to Spreadsheet


From: Jambunathan K
Subject: Re: [O] org-export to Spreadsheet
Date: Thu, 23 Aug 2012 16:29:30 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Joost Helberg <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]