Search code examples
javascriptexceloffice-jsoffice-addinsexcel-web-addins

Excel Web Add-In using Querytables


Does anyone know how to use the Querytable object in an Excel Web Add-In?

I developed an Excel VSTO Add-In previously and would now like to use the same functionality instead of with VB in JS.

So lets say I just want to insert a querytable like I would with the following code in VB in JS:

QT = new_Ws.QueryTables.Add(Connection:=xConnection, Destination:=new_Ws.Range("A1"))
With QT
    .WebSelectionType = Microsoft.Office.Interop.Excel.XlWebSelectionType.xlAllTables
    .Refresh(False)
End With

How would I do that (I suppose in the Home.js file) in JavaScript?

The big question is: does the Web Add-In support the Querytables.Add function?

I could not try it, because I cannot find any documentation by Microsoft on JavaScript code, only VS (see the two links that I posted above).


Solution

  • OfficeJS doesn't provide any direct analog. You may find Excel JavaScript API overview for the reference. See Work with PivotTables using the Excel JavaScript API for more information.

    You can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team go through the planning process.