QueryTables¶
Use querytable for worksheet QueryTables backed by the desktop Excel COM object model.
Choose the Right Import Surface¶
| Need | Tool |
|---|---|
| Direct text/CSV import with delimiter and encoding control | querytable create-text |
| Legacy HTML page/table import through Excel's web-query engine | querytable create-web |
| Modern connectors, transformations, APIs, JSON, or reusable M | powerquery |
| Existing OLEDB/ODBC workbook connection | connection |
Text Import¶
querytable(action: 'create-text',
queryTableName: 'OrdersCsv',
sourcePath: 'C:\Data\orders.csv',
sheetName: 'Orders',
destinationAddress: 'A1',
delimiter: ',',
textQualifier: 'double-quote',
encoding: 65001,
hasHeaders: true)
delimiteris exactly one character.textQualifierisdouble-quote,single-quote, ornone.encodingis a Windows code page; use65001for UTF-8.- Creation refreshes synchronously so imported data is ready when the call returns.
Legacy Web Import¶
querytable(action: 'create-web',
queryTableName: 'RatesHtml',
url: 'https://example.com/rates.html',
sheetName: 'Rates',
destinationAddress: 'A1',
selectionType: 'specified-tables',
webTables: '1',
formatting: 'none')
selectionTypeisentire-page,all-tables, orspecified-tables.webTablesis required withspecified-tables.formattingisnone,rich-text, orall.- This is Excel's legacy HTML web-query engine, not a general HTTP or browser automation API.
Lifecycle and Refresh¶
Use list, view, set-properties, refresh, get-refresh-status, cancel-refresh, and delete for existing QueryTables.
Hard Exclusions¶
Local QueryTable COM automation cannot access Microsoft 365 cloud service state or APIs:
- No workbook sharing or permissions
- No coauthor presence, cursors, conflicts, or live collaboration state
- No comment @mentions, assignments, reactions, or notification delivery
- No authenticated Graph, SharePoint, Teams, or OneDrive service operations
- No Power Query M definition or modern connector configuration
Use the relevant Microsoft 365 service API for cloud workflows and powerquery for modern data transformation.