How to treat Calc worksheet as a Resultset

Good Morning,

In VBA , the ADODB object can be used to treat structured worksheet as a table/recordset.

Is there a similar feature for Calc, where I could use Python or Basic to open a sheet as table/resultset?

Thank you again for all of your assistance

Regards

Zafar

menu:File>New>Database…
Connect to existing database of type “Spreadsheet”.
Register the database.
Save the database.
Every sheet’s used area appears as a table.
Every database (Data>Define…) range appears as a table.
There is a feature to hide tables.
Since this is still a spreadsheet, you have to use Calc for editing.
Queries are limited to one table with no aggregate queries and functions limited to these: SQL functions for file based database drivers

2 Likes

Thank you very much for this. It does help a little bit. I will use this solution when appropriate.

    ctx =uno.getComponentContext()
    smgr = ctx.ServiceManager
    dbctx = smgr.createInstance('com.sun.star.sdb.DatabaseContext')
    db  = dbctx.getByName('My Registered Database Name')
    mri(db)
2 Likes