-2

How to write a command to terminal in Linux that open LibreOffince Calc and inserts files in it? All files consist of one column.

3

It is not clear what do you mean by "insert files in it"... May be you can give some examples.

You can open calc from commandline by

libreoffice --calc
  • Thank you. I mean I have file1 that consists of one column, file2 that consists of one column... and I want to insert file1, file2 to calc in a way that in column A will be file1, in column B file2... – Lukáš Altman Apr 6 at 21:29
  • @LukášAltman Clarifications to the question should be edits to the question itself, not left as comments to answers. – Kusalananda Apr 7 at 12:51
1

It is not clear what is the format of your original files and format of the expected output (e.g. odf, sxw, xls, xlsx, csv, etc.)

Simplest case: all csv

Then you can use bash's paste command:

paste <(cat file1.csv) <(cat file2.csv) > out.csv

And then open out.csv in libreoffice:

libreoffice --calc out.csv

Complicated case: xls or odf or other:

In such cases, I would recommend converting them to csv and use the trick as above.

libreoffice --convert-to csv file1.xls
libreoffice --convert-to csv file2.xls
paste <(cat file1.csv) <(cat file2.csv) > out.csv
libreoffice --calc out.csv

If you want your output to preserve the formatting and other properties, then you will have use other tools. Another similar tool you can try is oooPy, though I must admit, I have never used it! Also not sure if it works with latest version of libreoffice.

  • Thank you very much. And what is wrong with this? paste <(cat vypis.csv) <(cat sums.csv) <(cat L1R.csv) <(cat L2R.csv) <(cat L3R.csv) > out.csv it gives error: cs: 17: cs: Syntax error: "(" unexpected ? – Lukáš Altman Apr 7 at 19:44
  • It works when I write it in terminal but is it possible to write it in file that is used like sh file in terminal? – Lukáš Altman Apr 7 at 20:59
  • @LukášAltman, you have be more specific and precise... give more details of exactly what you want!!! I dont know which shell you are using, but if I put this exact line in a script with #!/bin/bash as the first line, it works! – Mike V.D.C. Apr 8 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.