I want to add lines to a libreoffice calc table from command line. But I have no idea how.
I just figured out how to start libreoffice from command line.
For example what iam looking for:
-The test.ods-file
before
Name Text
Hans Bla
Christian BlaBlub
I enter…
ubuntu> [a command -insert] Alf|test -file=test.ods
so that "Alf" and "test" is added as next line in the table.
-The test.ods-file
after:
Name Text
Hans Bla
Christian BlaBlub
Alf test
Best Answer
.ods
is an archive. So you will need to extract the archive.From the documentation:
So it is not as simple as
since you also need to insert the XML parts.
When you look at content.xml and you want to add a new row below the last one you would need to add something like this ...
before
and then zip the files again (
zip -r ../test2.ods .
from the directory with the files).Result:
To edit the file from command line I used this command. I put the example in ~/Downloads and made a tmp/ in there to test. All the commands used for this:
All you need to do is replace the text segments with your own.
Newer version courtesy of Terdon (it uses variables to make it better readable):
The "#" is a separator. If you have a "#" in the text use something else.