How can I disable popups when running convert command

Hello, I have a powershell script that uses this command in a loop to convert many .docx, .pptx, and .xlsx files to pdf: “& “C:\Program Files\LibreOffice\program\soffice” --headless --convert-to pdf $inputFile --outdir $outputSubFolder”

This works great except for one small thing, occasionally there will be a .xlsx file that apparently has too many columns because I get this error popup:

Warning loading document SITEPLAN_15109_5732604_396991_(22) TM-1 .xlsx:
The data could not be loaded completely because the maximum number of columns per sheet was exceeded.

That is fine, but I have this is a script so I can start the script and then do something else while it runs. I don’t want to have to click the okay button to continue past that file. There are 2 solutions that I’m looking for, but 2 might be more of a powershell thing and less of a libre office thing.

  1. How can I disable this popup and just keep going or automatically click okay or something

  2. Currently I have an error .txt file that gets any error document paths written to it (0KB files, wrong extension, etc) I would like to be able to add the path to the .xlsx file that produces this popup, but am not sure how to do that.

Thanks in advance, please feel free to ask for clarifications

If the LibreOffice instance was started with --headless dialogs should not occur. Make sure you are not already running a “normal” LibreOffice instance with GUI (even if hidden) which the command line would connect against. Best force a temporary instance with a temporary / standalone user profile, like

soffice -env:UserInstallation=file:///C:/temp/mydir --headless --convert-to pdf $inputFile --outdir $outputSubFolder

Note that the env:UserInstallation argument MUST be a valid URL (here starting with file:/// for localhost), not just a system path notation like C:\temp\mydir

LibreOffice will create a user directory and .lock file in the given path.

Thanks erAck, the hidden instance of libre office was indeed the issue. After killing that process the script runs without any warning popups. Thank you!

I’m still not sure about the second part of your answer however, what is the purpose of running the command you posted vs the command that I am currently using?

The purpose is solely to use a different user profile to not connect against a running instance with the standard user profile as a user profile can’t be shared among multiple instances.

Regarding your error log file I have no ad-hoc idea. Most times these excess columns are harmless when resulting from empty columns being user defined formatted, but if they contained data then that data would be lost.

Anyhow, you might be interested in the unoconv utility, a wrapper written in Python to ease conversion using the LibreOffice PyUNO API, that exits with defined error codes for some common errors. See its GitHub page.

For mass conversions also unoserv may be interesting as it keeps a listening LibreOffice instance open (using the --accept=… connection option) to not have to start and tear down an instance for each conversion. May or may not work on Windows.