How to run a macro on multiple files (batch)?

I have a macro to create csv files from txt files.
THe macro works on opened files in calc.

I need to run this macro on multiple files inside a directory.
I have a files list in txt format, in case it’s needed.

I spent 4 hours searching (google) for the solution :frowning:

thanks a lot

“I have a macro to create csv files from txt files.” Does this mean you want to add certain separators and delimiters?

First you must specify several options in the command line. I’m not sure if all of those are needed, I just put all of them after the libreoffice executable (you did not specify platform. win, MacOsX, linux ?):
–invisible --nofirststartwizard --headless --norestore

Then you specify the files you want to operate on (try with the shell wildcards or a simple for loop, google on that for you OS) and last your macro : “macro:///Standard.Module1.your_macro_name”. Try to put your macro in the Standard Library, (which is always loaded), instead of your document.

Last but not least, in you macro code, you should close every document in order for LibreO to move to the next, otherwise the program is stuck waiting for something. Since you operate in “headless” mode nothing happens, so you must close the document .

Hope this helps