emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-export to Spreadsheet
@ 2012-08-23  8:34 Joost Helberg
  2012-08-23 10:59 ` Jambunathan K
  0 siblings, 1 reply; 3+ messages in thread
From: Joost Helberg @ 2012-08-23  8:34 UTC (permalink / raw)
  To: emacs-orgmode

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. 

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.

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?).

regards,

Joost

-- 
Snow B.V.        http://snow.nl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-export to Spreadsheet
  2012-08-23  8:34 org-export to Spreadsheet Joost Helberg
@ 2012-08-23 10:59 ` Jambunathan K
  2012-08-23 15:55   ` Joost Helberg
  0 siblings, 1 reply; 3+ messages in thread
From: Jambunathan K @ 2012-08-23 10:59 UTC (permalink / raw)
  To: Joost Helberg; +Cc: emacs-orgmode

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

-- 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-export to Spreadsheet
  2012-08-23 10:59 ` Jambunathan K
@ 2012-08-23 15:55   ` Joost Helberg
  0 siblings, 0 replies; 3+ messages in thread
From: Joost Helberg @ 2012-08-23 15:55 UTC (permalink / raw)
  To: kjambunathan; +Cc: emacs-orgmode

Jambunathan,

Thanks for the code, it will probably match what I need.

Regards,

Joost

>>>>> "Jambunathan" == Jambunathan K <kjambunathan@gmail.com> writes:
 > Subject: Re: org-export to Spreadsheet
 > From: Jambunathan K <kjambunathan@gmail.com>
 > To: Joost Helberg <joost@snow.nl>
 > Cc: emacs-orgmode@gnu.org
 > Date: Thu, 23 Aug 2012 16:29:30 +0530

 > 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

 > -- 


-- 
Snow B.V.        http://snow.nl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-23 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23  8:34 org-export to Spreadsheet Joost Helberg
2012-08-23 10:59 ` Jambunathan K
2012-08-23 15:55   ` Joost Helberg

Code repositories for project(s) associated with this 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).