[LibreOffice Calc 7.2, MariaDB (but I think this question is somewhat agnostic to the specific SQL version)]
In an earlier question, I needed to work out how to execute a shell script that expected parameters. (How to run 'AppleScriptTask' from LibraOffice Calc?)
In a new application, I now need to be able to receive data into a cell from a query that is based on the contents of other cells in my spreadsheet (i.e. a function).
One way would be to use ODBC, which I have installed and running, to put an SQL query into a cell, though I haven’t worked out how to do this. As an alternate approach, I’m now working on using a macro to perform the query and then put the result into the cell via the macro. However, what I definitely don’t want is to have ODBC access or expose the whole table in the spreadsheet.
Another way would be to collect the output from a shell script (which in this case performs the same query I mentioned above and echoes the result to stdout) and have it entered into a cell via a macro. My understanding though is that com.sun.star.system.SystemShellExecute
only returns the exit status of the script.
Has anyone done anything similar?