Calc on linux - populate a column with the document title from the command line

i recently discovered the command line abilities of libreoffice, which are awesome. i have documents in which i’d like to have every cell in a column, say H, contain the document title for the current document. is this possible from the command line? i’m running ubuntu linux.

thanks,
babag

thanks for the suggestions. much appreciated. i wound up using awk to accomplish what i wanted. it’s something i’ve used before, albeit with a lot of help. once again, with a lot of help, this is the command i got to do what i wanted:

for f in *.tsv; do awk 'BEGIN {OFS=FS="\t"} NR==1 {f=substr(FILENAME,1,length(FILENAME)-4); print $0,"SOURCE_FILE"; next} {print $0,f}' "$f" > tmp && mv tmp "$f"; done

thanks again,
babag

:face_with_thermometer:

you can preprocess your files with a 1-liner to add
as first column: perl -i.bak -pe 's/^/$ARGV\t/' *.tsv
or last column: perl -i.bak -pe 's/$/\t$ARGV/' *.tsv


:warning: experiment on copies of your files

thanks for this but it’s way out of my wheelhouse. i can’t follow it at all.

although a bit cryptic, it’s pretty self-explanatory :wink:
just run it on the command line.
e.g.

$ date > your_example.tsv
$ perl  -pe 's/^/$ARGV\t/'  your_example.tsv
your_example.tsv	Sun Jul 13 08:50:46 AM CEST 2025


for reference :

ARGV - Perldoc Browser

The main point to understand is: This suggestion is NOT processing Calcs .ods-files but tab-separated-values in text-files. I do similiar stuff with awk instead of perl.
.
If you wish to use LibreOffice to modify Calc-files, you would need to write a macro inside LibreOffice first (BASIC or python etc), then call this macro from Command-line.
.
Another approach is sending commands over a network-socket, if one is more familiar with this kind of programming.