unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* get text from LibreOffice Calc to Emacs Org-Mode
@ 2023-04-22 10:11 Gottfried
  2023-04-22 10:23 ` Ruijie Yu via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 18+ messages in thread
From: Gottfried @ 2023-04-22 10:11 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 590 bytes --]

Hi,

I am learning Emacs Org-mode

and would like to copy text from LibreOffice Calc to Emacs Org-mode.
So that I don’t need to copy every single part from here to there,
I would prefer, time saving, to get the whole text (quite much) in one 
go to Emacs org-mode and than adjust the text in org-mode.

What are the possibilities?
I tried to save the text in different formats, and open it in org-mode,
but mostly the text couldn’t be read or was not useable.

Does somebody know what are good possibilities to get the text into 
org-mode?

Kind regards

Gottfried


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-22 10:11 get text from LibreOffice Calc to Emacs Org-Mode 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-25 10:07   ` Uwe Brauer
  0 siblings, 2 replies; 18+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-04-22 10:23 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs


Gottfried <gottfried@posteo.de> writes:

> [[PGP Signed Part:Undecided]]
> Hi,
>
> I am learning Emacs Org-mode
>
> and would like to copy text from LibreOffice Calc to Emacs Org-mode.
> So that I don’t need to copy every single part from here to there,
> I would prefer, time saving, to get the whole text (quite much) in one go to
> Emacs org-mode and than adjust the text in org-mode.
>
> What are the possibilities?
> I tried to save the text in different formats, and open it in org-mode,
> but mostly the text couldn’t be read or was not useable.

Unless I'm mistaken, it already can be copy-pasted?

My steps below:

1. Open Calc
2. Type: Hello TAB World RET Good TAB Job
3. Select the 2-by-2 region A1 to B2
4. Press C-c to copy
5. Go to a buffer (I have /tmp/1.org)
6. Press C-y to paste (yank)

Does this work for you?  Or do you mean something else?

> Does somebody know what are good possibilities to get the text into org-mode?
>
> Kind regards
>
> Gottfried
>
> [2. OpenPGP public key --- application/pgp-keys; OpenPGP_0x61FAF349C9FB7F94.asc]...
>
> [[End of PGP Signed Part]]

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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-25 10:07   ` Uwe Brauer
  1 sibling, 1 reply; 18+ messages in thread
From: Gottfried @ 2023-04-23 12:44 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: help-gnu-emacs


[-- Attachment #1.1.1: Type: text/plain, Size: 1717 bytes --]

Hi,

thanks for your help.

I tried this already, and it works, but the text is almost a mass.
it is difficult to put it in order in emacs.
I would always check both, libreoffice calc and emacs side by side to 
put the text in order in emacs org-mode.

That’s why I was asking that may be there is a better method  where the 
text in emacs org-mode  is more ordered.

If there is no alternative, I have to do it like that.

Kind regards

Gottfried



Am 22.04.23 um 12:23 schrieb Ruijie Yu:
> 
> Gottfried <gottfried@posteo.de> writes:
> 
>> [[PGP Signed Part:Undecided]]
>> Hi,
>>
>> I am learning Emacs Org-mode
>>
>> and would like to copy text from LibreOffice Calc to Emacs Org-mode.
>> So that I don’t need to copy every single part from here to there,
>> I would prefer, time saving, to get the whole text (quite much) in one go to
>> Emacs org-mode and than adjust the text in org-mode.
>>
>> What are the possibilities?
>> I tried to save the text in different formats, and open it in org-mode,
>> but mostly the text couldn’t be read or was not useable.
> 
> Unless I'm mistaken, it already can be copy-pasted?
> 
> My steps below:
> 
> 1. Open Calc
> 2. Type: Hello TAB World RET Good TAB Job
> 3. Select the 2-by-2 region A1 to B2
> 4. Press C-c to copy
> 5. Go to a buffer (I have /tmp/1.org)
> 6. Press C-y to paste (yank)
> 
> Does this work for you?  Or do you mean something else?
> 
>> Does somebody know what are good possibilities to get the text into org-mode?
>>
>> Kind regards
>>
>> Gottfried
>>
>> [2. OpenPGP public key --- application/pgp-keys; OpenPGP_0x61FAF349C9FB7F94.asc]...
>>
>> [[End of PGP Signed Part]]
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-23 12:44   ` Gottfried
@ 2023-04-23 12:55     ` Platon Pronko
  2023-04-23 13:22       ` Gottfried
  0 siblings, 1 reply; 18+ messages in thread
From: Platon Pronko @ 2023-04-23 12:55 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs

On 2023-04-23 20:44, Gottfried wrote:
> Hi,
> 
> thanks for your help.
> 
> I tried this already, and it works, but the text is almost a mass.
> it is difficult to put it in order in emacs.
> I would always check both, libreoffice calc and emacs side by side to put the text in order in emacs org-mode.
> 
> That’s why I was asking that may be there is a better method  where the text in emacs org-mode  is more ordered.
> 
> If there is no alternative, I have to do it like that.
> 
> Kind regards
> 
> Gottfried

Hi!

As I understand your problem - you are pasting the table contents from Calc, and getting something like this:

```
column1 column2 column2
alpha 1 one
beta 2 two
gamma 3 three
```

while you want to get this text formatted as an org table, something like this:

```
|---------+---------+---------|
| column1 | column2 | column3 |
| alpha   |       1 | one     |
| beta    |       2 | two     |
| gamma   |       3 | three   |
|---------+---------+---------|
```

Is my understanding correct?

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-23 12:55     ` Platon Pronko
@ 2023-04-23 13:22       ` Gottfried
  2023-04-24  5:46         ` Platon Pronko
  0 siblings, 1 reply; 18+ messages in thread
From: Gottfried @ 2023-04-23 13:22 UTC (permalink / raw)
  To: Platon Pronko; +Cc: help-gnu-emacs


[-- Attachment #1.1.1: Type: text/plain, Size: 2001 bytes --]

Hi,

yes, wonderful, you understood me.

Sorry, for not explaining it more correctly.

Because I have much text in each cell,
colums a and column b,
each with much text,
and underneath the same,
and so on...

I can’t create such a nice diagramm like this in emacs yet,
so I couldn’ explain it graphically.

   |---------+---------|
 > | column1 | column2 |
 > | alpha   |       1 |
 > | beta    |       2 |
 > | gamma   |       3 |
 > |---------+---------|
   | column1 | column2 |
 > | alpha   |       1 |
 > | beta    |       2 |
 > | gamma   |       3 |
 > |---------+---------|
   | column1 | column2 |
 > | alpha   |       1 |
 > | beta    |       2 |
 > | gamma   |       3 |
 > |---------+---------|


Kind regards

Gottfried


Am 23.04.23 um 14:55 schrieb Platon Pronko:
> On 2023-04-23 20:44, Gottfried wrote:
>> Hi,
>>
>> thanks for your help.
>>
>> I tried this already, and it works, but the text is almost a mass.
>> it is difficult to put it in order in emacs.
>> I would always check both, libreoffice calc and emacs side by side to 
>> put the text in order in emacs org-mode.
>>
>> That’s why I was asking that may be there is a better method  where 
>> the text in emacs org-mode  is more ordered.
>>
>> If there is no alternative, I have to do it like that.
>>
>> Kind regards
>>
>> Gottfried
> 
> Hi!
> 
> As I understand your problem - you are pasting the table contents from 
> Calc, and getting something like this:
> 
> ```
> column1 column2 column2
> alpha 1 one
> beta 2 two
> gamma 3 three
> ```
> 
> while you want to get this text formatted as an org table, something 
> like this:
> 
> ```
> |---------+---------+---------|
> | column1 | column2 | column3 |
> | alpha   |       1 | one     |
> | beta    |       2 | two     |
> | gamma   |       3 | three   |
> |---------+---------+---------|
> ```
> 
> Is my understanding correct?
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Platon Pronko @ 2023-04-24  5:46 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs

On 2023-04-23 21:22, Gottfried wrote:
> Hi,
> 
> yes, wonderful, you understood me.
> 
> Sorry, for not explaining it more correctly.
> 
> Because I have much text in each cell,
> colums a and column b,
> each with much text,
> and underneath the same,
> and so on...
> 
> I can’t create such a nice diagramm like this in emacs yet,
> so I couldn’ explain it graphically.
> 
>    |---------+---------|
>  > | column1 | column2 |
>  > | alpha   |       1 |
>  > | beta    |       2 |
>  > | gamma   |       3 |
>  > |---------+---------|
>    | column1 | column2 |
>  > | alpha   |       1 |
>  > | beta    |       2 |
>  > | gamma   |       3 |
>  > |---------+---------|
>    | column1 | column2 |
>  > | alpha   |       1 |
>  > | beta    |       2 |
>  > | gamma   |       3 |
>  > |---------+---------|
> 

Is there multiline text, as well?

I'm afraid there's nothing built in that can handle your requirements.

You can always achieve that with a bit of coding, however. I'm not sure how comfortable it would be for you, though - it might get quite convoluted, and at that point I somewhat doubt if it makes sense to use Emacs for such tabular data at all (I usually think that it's best to choose the right tool for the job).

That said, if you still want to copy the data from Calc into Emacs and format it according to your needs, you have two options:

1. Use some external script to transfer clipboard contents from Calc format into Org-table format. So you C-c in Calc to copy the table, invoke external script to transform the clipboard, then paste the contents into Emacs. Personally I'd prefer Python, but you can use whatever you are comfortable with;

2. Get clipboard contents and perform transformation directly in Emacs. So you C-c in Calc, then call M-x paste-from-libreoffice-calc in Emacs. The code will be something like this:

(defun paste-from-libreoffice-calc ()
   (interactive)
   (let* ((selection (gui-get-selection 'CLIPBOARD (intern "application/x-libreoffice-tsvc")))
          (tsvc ...) ;; decode from UTF-16
          (result ...)) ;; parse tsvc, format it into an Org-table
     (insert result)))

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-04-24  6:53 UTC (permalink / raw)
  To: Platon Pronko; +Cc: Gottfried, help-gnu-emacs


Platon Pronko <platon7pronko@gmail.com> writes:

> On 2023-04-23 21:22, Gottfried wrote:
>> Hi,
>> yes, wonderful, you understood me.
>> Sorry, for not explaining it more correctly.
>> Because I have much text in each cell,
>> colums a and column b,
>> each with much text,
>> and underneath the same,
>> and so on...
>> I can’t create such a nice diagramm like this in emacs yet,
>> so I couldn’ explain it graphically.
>>    |---------+---------|
>>  > | column1 | column2 |
>>  > | alpha   |       1 |
>>  > | beta    |       2 |
>>  > | gamma   |       3 |
>>  > |---------+---------|
>>    | column1 | column2 |
>>  > | alpha   |       1 |
>>  > | beta    |       2 |
>>  > | gamma   |       3 |
>>  > |---------+---------|
>>    | column1 | column2 |
>>  > | alpha   |       1 |
>>  > | beta    |       2 |
>>  > | gamma   |       3 |
>>  > |---------+---------|
>> 
>
> Is there multiline text, as well?
>
> I'm afraid there's nothing built in that can handle your requirements.
>
> You can always achieve that with a bit of coding, however. I'm not sure how comfortable it would be for you, though - it might get quite convoluted, and at that point I somewhat doubt if it makes sense to use Emacs for such tabular data at all (I usually think that it's best to choose the right tool for the job).
>
> That said, if you still want to copy the data from Calc into Emacs and format it according to your needs, you have two options:
>
> 1. Use some external script to transfer clipboard contents from Calc format into Org-table format. So you C-c in Calc to copy the table, invoke external script to transform the clipboard, then paste the contents into Emacs. Personally I'd prefer Python, but you can use whatever you are comfortable with;
>
> 2. Get clipboard contents and perform transformation directly in Emacs. So you C-c in Calc, then call M-x paste-from-libreoffice-calc in Emacs. The code will be something like this:
>
> (defun paste-from-libreoffice-calc ()
>   (interactive)
>   (let* ((selection (gui-get-selection 'CLIPBOARD (intern "application/x-libreoffice-tsvc")))

Why not just use quote? :)

----

Alternatively, you may find `org-table-import' useful.  I believe Calc
can export to simple formats like CSV or TSV, and you may be able to use
this function to convert into a table.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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               ` Gottfried
  0 siblings, 2 replies; 18+ messages in thread
From: Platon Pronko @ 2023-04-24  7:35 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: Gottfried, help-gnu-emacs

> Why not just use quote? :)

Wasn't immediately sure that would work :) But obviously that's better, thank you!

> Alternatively, you may find `org-table-import' useful.  I believe Calc
> can export to simple formats like CSV or TSV, and you may be able to use
> this function to convert into a table.

I tested it - it is unable to process multiline cells correctly.
And I suspect that was one of the main problems Gottfried was facing.




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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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:24               ` Gottfried
  1 sibling, 1 reply; 18+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-04-24  7:45 UTC (permalink / raw)
  To: Platon Pronko; +Cc: Gottfried, help-gnu-emacs


Platon Pronko <platon7pronko@gmail.com> writes:

>> Alternatively, you may find `org-table-import' useful.  I believe Calc
>> can export to simple formats like CSV or TSV, and you may be able to use
>> this function to convert into a table.
>
> I tested it - it is unable to process multiline cells correctly.
> And I suspect that was one of the main problems Gottfried was facing.

If it's about multiline cells, unless I'm mistaken, Org doesn't support
it either, so it is not a surprise to me that trying to import it from
elsewhere causes problems.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Platon Pronko @ 2023-04-24  8:24 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: Gottfried, help-gnu-emacs

On 2023-04-24 15:45, Ruijie Yu wrote:
> If it's about multiline cells, unless I'm mistaken, Org doesn't support
> it either, so it is not a surprise to me that trying to import it from
> elsewhere causes problems.

Gottfried's example was:

> |---------+---------|
> | column1 | column2 |
> | alpha   |       1 |
> | beta    |       2 |
> | gamma   |       3 |
> |---------+---------|
> | column1 | column2 |
> | alpha   |       1 |
> | beta    |       2 |
> | gamma   |       3 |
> |---------+---------|
> | column1 | column2 |
> | alpha   |       1 |
> | beta    |       2 |
> | gamma   |       3 |
> |---------+---------| 

and it's possible to recreate such structure in Org. It's not multiline cells per se,
it's groups of normal cells separated by hlines.
But without knowing the use-case it's impossible to say if that's what he wants or not.



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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  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               ` Gottfried
  2023-04-24  8:45                 ` Platon Pronko
  1 sibling, 1 reply; 18+ messages in thread
From: Gottfried @ 2023-04-24  8:24 UTC (permalink / raw)
  To: Platon Pronko, Ruijie Yu; +Cc: help-gnu-emacs


[-- Attachment #1.1.1: Type: text/plain, Size: 2055 bytes --]

Hi,

thanks for help.

I tried with "quote".

It gets the same result, as if I simply copy the text from LibreOffice 
calc to Emacs.org-mode

May be there is no other solution.
-----------------------------------------------------------------------
> 1. Use some external script to transfer clipboard contents from Calc format into Org-table format. So you C-c in Calc to copy the table, invoke external script to transform the clipboard, then paste the contents into Emacs. Personally I'd prefer Python, but you can use whatever you are comfortable with; 

this seems to be too difficult for me.
--------------------------------------------------------------------

> 2. Get clipboard contents and perform transformation directly in Emacs. So you C-c in Calc, then call M-x paste-from-libreoffice-calc in Emacs. The code will be something like this:
> 
> (defun paste-from-libreoffice-calc ()
>   (interactive)
>   (let* ((selection (gui-get-selection 'CLIPBOARD (intern "application/x-libreoffice-tsvc")))
>          (tsvc ...) ;; decode from UTF-16
>          (result ...)) ;; parse tsvc, format it into an Org-table
>     (insert result))) 

I don’t know if that possibility would make a difference to simply copy 
the text.
Is sees to me also difficult to use, because I don’t know emacs so much 
yet. I am learning.
AFAIU I would have to copy this part into my init.el file
--------------------------------------------------------------------------------
Kind regards

Gottfried



Am 24.04.23 um 09:35 schrieb Platon Pronko:
>> Why not just use quote? :)
> 
> Wasn't immediately sure that would work :) But obviously that's better, 
> thank you!
> 
>> Alternatively, you may find `org-table-import' useful.  I believe Calc
>> can export to simple formats like CSV or TSV, and you may be able to use
>> this function to convert into a table.
> 
> I tested it - it is unable to process multiline cells correctly.
> And I suspect that was one of the main problems Gottfried was facing.
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-24  8:24                 ` Platon Pronko
@ 2023-04-24  8:38                   ` Gottfried
  0 siblings, 0 replies; 18+ messages in thread
From: Gottfried @ 2023-04-24  8:38 UTC (permalink / raw)
  To: Platon Pronko, Ruijie Yu; +Cc: help-gnu-emacs


[-- Attachment #1.1.1: Type: text/plain, Size: 1838 bytes --]

Hi,

thanks for help.

I wanted 2 columns,
and underneath left some "topic overview" and to the right "the use of 
terminal commands with explanation"
So I need for the left and for the right cell several sentences of text.

    |---------+---------|
 >> | column1 | column2 |
 >> | alpha   |       1 |
 >> | beta    |       2 |
 >> | gamma   |       3 |
 >> |---------+---------|

in this example
alpha would be sentence 1
beta would be sentence 2
gamma would be sentence 3
and so on
everything together is one cell.

to the right of it
is the cell with answers.

separated with something, not important, simply to have a certain 
overview, a structure.

Later I would adjust it in org-mode.

hopefully I could explain it.

Kind regards

Gottfried

Am 24.04.23 um 10:24 schrieb Platon Pronko:
> On 2023-04-24 15:45, Ruijie Yu wrote:
>> If it's about multiline cells, unless I'm mistaken, Org doesn't support
>> it either, so it is not a surprise to me that trying to import it from
>> elsewhere causes problems.
> 
> Gottfried's example was:
> 
>> |---------+---------|
>> | column1 | column2 |
>> | alpha   |       1 |
>> | beta    |       2 |
>> | gamma   |       3 |
>> |---------+---------|
>> | column1 | column2 |
>> | alpha   |       1 |
>> | beta    |       2 |
>> | gamma   |       3 |
>> |---------+---------|
>> | column1 | column2 |
>> | alpha   |       1 |
>> | beta    |       2 |
>> | gamma   |       3 |
>> |---------+---------| 
> 
> and it's possible to recreate such structure in Org. It's not multiline 
> cells per se,
> it's groups of normal cells separated by hlines.
> But without knowing the use-case it's impossible to say if that's what 
> he wants or not.

-- 



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-24  8:24               ` Gottfried
@ 2023-04-24  8:45                 ` Platon Pronko
  0 siblings, 0 replies; 18+ messages in thread
From: Platon Pronko @ 2023-04-24  8:45 UTC (permalink / raw)
  To: Gottfried, Ruijie Yu; +Cc: help-gnu-emacs

>> 1. Use some external script to transfer clipboard contents from Calc format into Org-table format. So you C-c in Calc to copy the table, invoke external script to transform the clipboard, then paste the contents into Emacs. Personally I'd prefer Python, but you can use whatever you are comfortable with; 
> 
> this seems to be too difficult for me.
> --------------------------------------------------------------------
> I don’t know if that possibility would make a difference to simply copy the text.
> Is sees to me also difficult to use, because I don’t know emacs so much yet. I am learning.
> AFAIU I would have to copy this part into my init.el file

Unfortunately I don't think there is a way to do this without coding :( Looks like the only way is to manually adjust it, for now.




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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-22 10:23 ` Ruijie Yu via Users list for the GNU Emacs text editor
  2023-04-23 12:44   ` Gottfried
@ 2023-04-25 10:07   ` Uwe Brauer
  1 sibling, 0 replies; 18+ messages in thread
From: Uwe Brauer @ 2023-04-25 10:07 UTC (permalink / raw)
  To: help-gnu-emacs

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

>>> "RYvUlftGEte" == Ruijie Yu via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:

> Gottfried <gottfried@posteo.de> writes:

>> [[PGP Signed Part:Undecided]]
>> Hi,
>> 
>> I am learning Emacs Org-mode
>> 
>> and would like to copy text from LibreOffice Calc to Emacs Org-mode.
>> So that I don’t need to copy every single part from here to there,
>> I would prefer, time saving, to get the whole text (quite much) in one go to
>> Emacs org-mode and than adjust the text in org-mode.
>> 
>> What are the possibilities?
>> I tried to save the text in different formats, and open it in org-mode,
>> but mostly the text couldn’t be read or was not useable.

This is what I use

(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)))


> Unless I'm mistaken, it already can be copy-pasted?


-- 
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 --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
@ 2023-04-28 15:57 Gottfried
  2023-04-28 19:14 ` Uwe Brauer
  0 siblings, 1 reply; 18+ messages in thread
From: Gottfried @ 2023-04-28 15:57 UTC (permalink / raw)
  To: oub, help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 1409 bytes --]

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.

and then I opened this libreoffice calc file in emacs org-mode.
there were unreadably stuff
So may be I misunderstood you.
-- 
Kind regards

Gottfried


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-28 15:57 Gottfried
@ 2023-04-28 19:14 ` Uwe Brauer
  2023-04-30 11:33   ` Gottfried
  0 siblings, 1 reply; 18+ messages in thread
From: Uwe Brauer @ 2023-04-28 19:14 UTC (permalink / raw)
  To: Gottfried; +Cc: oub, help-gnu-emacs@gnu.org

[-- 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 --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-28 19:14 ` Uwe Brauer
@ 2023-04-30 11:33   ` Gottfried
  2023-04-30 13:05     ` Uwe Brauer
  0 siblings, 1 reply; 18+ messages in thread
From: Gottfried @ 2023-04-30 11:33 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 3882 bytes --]

Hi,
thanks very much for your help.

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

yes

I have no formulas in my spreadsheet file, only text.

2.
Do I have to install those two packages
(gnumerics the other is xlsx2csv)
in my GNU Guix Distro
(which I guess, you mean that),
or within emacs
(which I don’t guess, but I prefer to ask)

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

Do you mean "check the path" in your functions?
(which I guess you mean that)

GNU Guix is different to a normal Linux distro,
but we will see.



Kind regards

Gottfried



Am 28.04.23 um 21:14 schrieb Uwe Brauer:
>>>> "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
> 
> 
> 

-- 



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: get text from LibreOffice Calc to Emacs Org-Mode
  2023-04-30 11:33   ` Gottfried
@ 2023-04-30 13:05     ` Uwe Brauer
  0 siblings, 0 replies; 18+ messages in thread
From: Uwe Brauer @ 2023-04-30 13:05 UTC (permalink / raw)
  To: Gottfried; +Cc: Uwe Brauer, help-gnu-emacs@gnu.org

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

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

> Hi,
> thanks very much for your help.

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

> yes

Good I am not sure what MTA you are using, but your and my quotes are not clearly distinguishable in gnus (Emacs).


> I have no formulas in my spreadsheet file, only text.

> 2.
> Do I have to install those two packages
> (gnumerics the other is xlsx2csv)
> in my GNU Guix Distro
> (which I guess, you mean that),
> or within emacs
> (which I don’t guess, but I prefer to ask)


I don't think it would be possible to install gnumercis (which is a compiled C binary I think) or xlsx2csv  in emacs. I am not sure that it would make sense.

These are external programs and my lisp wrapper simply execute them, in order to do that the path to that executables must be set correctly in emacs, where you start them.

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

> Do you mean "check the path" in your functions?
> (which I guess you mean that)

I mean the line

  (let* ((source-file  (file-name-sans-extension (buffer-file-name (current-buffer))))
         (org-odt-convert-processes '(("gnumeric" "~/.local/bin/xlsx2csv %i %o"))))

org-odt-convert-processes is supposed to use gnumeric and xlsx2csv and
in might be necessary to use an explicit path like 

         (org-odt-convert-processes '(("/gnu-giux/usr/bin/gnumeric" "~/.local/bin/xlsx2csv %i %o"))))

Or whatsoever

> GNU Guix is different to a normal Linux distro,
> but we will see.

There are so many distributions that this is difficult to know.
Different in which sense?

Regards

Uwe Brauer
-- 
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 --]

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

end of thread, other threads:[~2023-04-30 13:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-22 10:11 get text from LibreOffice Calc to Emacs Org-Mode 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
  -- strict thread matches above, loose matches on Subject: below --
2023-04-28 15:57 Gottfried
2023-04-28 19:14 ` Uwe Brauer
2023-04-30 11:33   ` Gottfried
2023-04-30 13:05     ` Uwe Brauer

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