emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Use babel to import table data from OpenDocument spreadsheets?


From: Jambunathan K
Subject: Re: [O] Use babel to import table data from OpenDocument spreadsheets?
Date: Fri, 19 Jul 2013 00:35:02 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Jambunathan K <address@hidden> 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 <address@hidden> 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



reply via email to

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