Import Web Content into Excel with From Web or VBA
Question details
Import website content into Excel using From Web or a VBA macro that reads a URL from cell B2.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to load website data, such as weather statistics, into a worksheet rather than only create a link to the page.
- Observed behavior
- A macro that creates a hyperlink opens the website but does not import its content into Excel.
Copy the URL of a page containing an accessible HTML table, and confirm that your Excel version supports From Web or VBA web queries. For the macro method, save the workbook as an Excel Macro-Enabled Workbook (.xlsm) and enable macros only if you trust the code and source.
Import a web table using Excel From Web
Use the built-in import command to select and load a table without writing a macro.
In Excel, select Data > From Web. In some versions, the command is under Data > Get Data > From Other Sources > From Web.
Paste the website address into the URL field and select OK. If prompted, choose the appropriate access method and connect.
In Navigator, select the table containing the information you need and check its preview.
Select Load to add the table to Excel, or select Transform Data to edit it before loading. To update it later, use Data > Refresh All.
Import web tables with a VBA macro
Use this method to read the page URL from B2 and load available HTML tables into a new worksheet.
Work with Imported Spreadsheet Data in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for Microsoft Excel files, making it easy to move and work with imported data. It does not fix Excel's From Web or VBA web-query features.

Frequently Asked Questions
Does a VBA hyperlink import website data into Excel?
No. A hyperlink opens the page when clicked; it does not place the page content in worksheet cells. Use Data > From Web or a supported web query to import data.
How can I refresh an imported web table?
Select Data > Refresh All to update supported external data connections. The refresh can fail if the website changes or requires credentials.
Why is the table missing from Navigator?
The site may generate the table with JavaScript, require authentication, or not expose it as a usable HTML table. Check for a downloadable CSV or an API on the website.
Where should I put the URL for the VBA example?
Paste the complete page URL into B2 on the active worksheet, then run ImportWebTables from Developer > Macros. The macro creates a new worksheet for the results.




