LibreOffice is amazing, beside being able to open many document formats, it can run headless and has command line options which allow automating some tasks such as converting format that would not be possible otherwise.
https://help.libreoffice.org/latest/en-US/text/shared/guide/...
https://opensource.com/article/21/3/libreoffice-command-line