Data Import & Export

Import Web Content into Excel with From Web or VBA

Jason MillerJason Miller Nov 20, 2026 869 views

Question details

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

Import Web Content into Excel with From Web or VBA
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.
Before you start

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.

Solution 1Recommended

Import a web table using Excel From Web

Use the built-in import command to select and load a table without writing a macro.

1
Open From Web

In Excel, select Data > From Web. In some versions, the command is under Data > Get Data > From Other Sources > From Web.

2
Enter the page URL

Paste the website address into the URL field and select OK. If prompted, choose the appropriate access method and connect.

3
Select the data

In Navigator, select the table containing the information you need and check its preview.

4
Load the table

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.

Page compatibility: A page that requires a login, generates its data with JavaScript, or does not expose a usable table may not import correctly.
Free Microsoft Office alternative

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.

Open and edit imported web-table data in WPS SpreadsheetsCompatible with Microsoft Excel formats, including XLSXUse a familiar interface for everyday spreadsheet workMove existing spreadsheets into a free, lightweight office suite
microsoft office alternative - wps office

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.