LibreOffice 5.3.6.1 30(Build:1) Error: source file could not be loaded

I am pretty new to Linux and Libreoffice, very green. I currently have “LibreOffice 5.3.6.1 30(Build:1)” installed on Red Hat Enterprise Linux Server release 7.6 whenever I try to convert a *.xlsx file to PDF I encounter the error “Error: source file could not be loaded” I have tried several command line to help fix this but nothing seems to work. Any advice and or suggestion are welcome.

/usr/lib64/libreoffice/program/soffice --headless --convert-to pdf *.xlsx --output .
/bin/libreoffice --headless --convert-to pdf:writer_pdf_Export *.xlsx --outdir .
/bin/soffice --headless --convert-to pdf test-excel.xlsx --outdir .

[erAck: edited to make that a command line block (selected and Ctrl+K)]

*.xlsx

And what tells ls -l ./*.xlsx (probably ls: cannot access './*.xlsx': No such file or directory)?

@anon73440385: *.xlsx are excel files in my local directory

**~/temp/test-01]:-->ls -l ./*.xlsx**
-rw-rw-r-- 1 rsingh1 general 19127 Jul  2 13:05 ./test-rj-1.xlsx
-rw-rw-r-- 1 rsingh1 general 19127 Jul  2 13:06 ./test-rj-2.xlsx

All three invocations are wrong because the --outdir . option (note also there is no --output option) has to come before the files to be converted, see soffice --help, as is it is tried to be opened as input file which of course does not exist. This should work

soffice --headless --convert-to pdf --outdir . *.xlsx

--outdir . current directory is the default anyway so you can as well omit it.

Also note that using the pdf:writer_pdf_Export filter for spreadsheet input files doesn’t make sense…

Thank you very much for your suggestion. I tried your command line and I got the same error as before:
Error: source file could not be loaded

I am wondering if the following would have any impact on how this works

  • The executable soffice is owned by ‘root’ user
  • The command line that is being executed is being done as my-user which is different from ‘root’
  • Also want to make clear that the Excel files that I am trying to convert to PDF is NOT on a Network storage or drive. They are stored locally to the machine.

And can you open these files interactively?

soffice test-rj-1.xlsx

Yes sir I can

Any additional recommendations or suggestions

Make sure that the you have installed libreoffice-calc package. Installing libreoffice-common and its buddies does not install Calc, so there’s no LibreOffice component which knows how to handle xlsx files.

tl;dr: sudo apt install libreoffice-calc

1 Like