How to save a file in .csv format using a com object?

Hello. I open a .xlsm file using my script written in Lua. This is how I can get the workbook:

self._desktop = self._calc:createInstance("com.sun.star.frame.Desktop")
self._workbook = openWorkbook(self._desktop, self._file_path)

How can I save a document to the path I need, in the new .csv format?

P.S. I would be happy with an example not only in Lua, but also in Python

probably you mean .csv but not .cvs !

1 Like

Yes! It’s my mistake, sorry.

You might want to get familiar with the API documentation. LibreOffice does not provide different sets of API for different cases - be it Basic, Python, C#, or COM objects accessed from Lua.

You also might want to use Development Tools in LibreOffice GUI to check the available objects’ types and methods; or use Basic, together with MRI extension, to analyze the object model.

For your specific case (if @karolus’ guess is correct), you need XStorable's storeAsURL (or storeToURL, depending on what you intend to do with the opened document next).

2 Likes