
The iqy files are used for Internet (Web) Query files, text files that contain data source (data source: A stored set of "source" information used to connect to a database. You can copy the message box contents just by hitting CTRL-C but you'll need to edit out some extra stuff when you paste.The iqy file extension is associated with with Microsoft Excel, one of the most popular and powerful tool you can use to create format spreadsheets, graphs and much more. In the VBA editor, use Insert > Module to create a new module and then paste in the following code: Option ExplicitĮach connection name will pop up in a message box like this:Īnd you can just copy the name you need when it pops up.
#Excel for mac web query code#
Here's some simple code to list the name of every connection in the workbook. Now changing the cell value should cause the query to refresh automatically ThisWorkbook.Connections("Query - Get station from aviationweather dot gov").Refresh If Not Application.Intersect(Target, ThisWorkbook.Names("StationName").RefersToRange) _ Private Sub Worksheet_Change(ByVal Target As Range) Open up the VBA Editor with ALT-F11, double-click on the relevant sheet object in the Project Explorer to open up the related code module and paste in the following code (but change the name of the named range and the name of the query to match your names): Option Explicit The first two should be straightforward and the name of the query is just "Query - " followed by the name shown in the Queries & Connections panel. We will need to know which sheet the cell is on, the name of the named range which refers to that cell and the name of the query we want to refresh. To make the query automatically refresh when the cell value changes, we need to use some VBA. You can access the privacy settings by selecting a cell in the data table, going to Query and choosing Edit, going to Home and choosing Data Source Settings, selecting Global Permissions and then using Edit Permissions on the relevant entries. You may get a warning about privacy settings - to fix this, I chose to give both the Excel file and the site the "public" level of privacy.
:max_bytes(150000):strip_icc()/MacFromHTMLImport-5be1c461c9e77c0026c8a239.jpg)
Now go to Home and click on Close & Load. This picture shows how things should now look: = Xml.Tables(Web.Contents("" & Excel.CurrentWorkbook() & "&hoursBeforeNow=1"))


I used "StationName" as the name of the range but you can use any name you like. Adapting from this answer, this is a two-step process.įirstly, create a named range for the cell that stores the value you will pass to the query.
