unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: Gottfried <gottfried@posteo.de>
Cc: oub@mat.ucm.es, "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: get text from LibreOffice Calc to Emacs Org-Mode
Date: Fri, 28 Apr 2023 21:14:26 +0200	[thread overview]
Message-ID: <87edo3hl9p.fsf@mat.ucm.es> (raw)
In-Reply-To: 2e695ff5-0954-3f1b-a889-b36b51e3fc38@posteo.de

[-- Attachment #1: Type: text/plain, Size: 3223 bytes --]

>>> "G" == Gottfried  <gottfried@posteo.de> writes:

Hello


> Hi,
>> (defun org-table-import-xlsx-to-csv-org () 
>> (interactive)
>> (let* ((source-file  (file-name-sans-extension (buffer-file-name (current-buffer))))
>> (xlsx-file (concat source-file ".xlsx"))
>> (csv-file (concat source-file ".csv"))
>> (org-odt-convert-processes '(("gnumeric" "~/.local/bin/xlsx2csv %i %o"))))
>> (org-odt-convert xlsx-file "csv")
>> (org-table-import csv-file  nil)))
>> 
>> 
>> (defun org-table-import-xls-to-csv-org () 
>> (interactive)
>> (let* ((source-file  (file-name-sans-extension (buffer-file-name (current-buffer))))
>> (xlsx-file (concat source-file ".xls"))
>> (csv-file (concat source-file ".csv")))
>> (org-odt-convert xlsx-file "csv")
>> (org-table-import csv-file  nil)))
>> 
>> (defun org-table-import-ods-to-csv-org () 
>> (interactive)
>> (let* ((source-file  (file-name-sans-extension (buffer-file-name (current-buffer))))
>> (xlsx-file (concat source-file ".ods"))
>> (csv-file (concat source-file ".csv")))
>> (org-odt-convert xlsx-file "csv")
>> (org-table-import csv-file  nil)))


> I copied your suggestions into my init.el file

> and tried to export a libreoffice calc file in xml format.


Now I am confused and maybe misunderstood you.

    1. Do you want to *import* a spreadsheet file (in ods, xls or xlsx
       format) import into a emacs org buffer

    2. Or do you want to *export* a org file to a spreadsheet file.

Both are possible, but from the thread I assume 1.

Before I am going to give a step by step instruction, two more comments

    1. The simplest strategy is, to convert the spreadsheet into csv and
       then into org in one go. However choosing this path means that
       you will not import spreadsheet formulas.

    2. Importing also spreadsheet formula is also possible but bit
       complicated, and most of the time you are faster by adding the
       formula manually in the org file yourself.

Now I should emphasise that you need two external programs, one is
gnumerics the other is xlsx2csv, a python based  converter that you can
install via pip. Check the path, that these programs are correctly
installed  before you execute my functions (or in case they are located
differently adapt my functions accordingly).

Now to the steps.

    1. Make a directory in which you copy the spreadsheet file (let us
       call this file table.ods).

    2. Now from within emacs, open the file table.org (that file does
       not exist but this way your create it). Please note it must have
       the same name as the spreadsheet file.

    3. Now since it is a ods file, run
       M-x org-table-import-ods-to-csv-org

    4. And the table should be generated, if not please report the error
       that then should be displayed

Regards



-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

  reply	other threads:[~2023-04-28 19:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 15:57 get text from LibreOffice Calc to Emacs Org-Mode Gottfried
2023-04-28 19:14 ` Uwe Brauer [this message]
2023-04-30 11:33   ` Gottfried
2023-04-30 13:05     ` Uwe Brauer
  -- strict thread matches above, loose matches on Subject: below --
2023-04-22 10:11 Gottfried
2023-04-22 10:23 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-04-23 12:44   ` Gottfried
2023-04-23 12:55     ` Platon Pronko
2023-04-23 13:22       ` Gottfried
2023-04-24  5:46         ` Platon Pronko
2023-04-24  6:53           ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-04-24  7:35             ` Platon Pronko
2023-04-24  7:45               ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-04-24  8:24                 ` Platon Pronko
2023-04-24  8:38                   ` Gottfried
2023-04-24  8:24               ` Gottfried
2023-04-24  8:45                 ` Platon Pronko
2023-04-25 10:07   ` Uwe Brauer

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edo3hl9p.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=gottfried@posteo.de \
    --cc=help-gnu-emacs@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.
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).