How to Import Data from a JavaScript Web Page using Excel Power Query
Question details
The user wants to import specific dynamically loaded data (e.g., 8-16 day weather forecast) from a website into Excel via Power Query, but the data is rendered via a JavaScript postback instead of being accessible through a direct URL.

- Product
- Excel Power Query
- Device & OS
- not provided
- Scenario
- Importing a data table from a web page where the target content requires JavaScript execution or specific form parameters to load, preventing the standard From Web connector from scraping the desired output.
- Observed behavior
- The default web URL only imports the initial page state (e.g., 0-7 days) because Power Query does not execute the JavaScript postback required to reveal the extended data.
Before attempting the import, verify the exact URL of the target web page and check if the site offers a dedicated API, which is often a more reliable method for extracting data than scraping JavaScript-rendered pages.
Use the Standard Power Query 'From Web' Connector
This is the primary method to fetch basic HTML tables from a URL when complex JavaScript navigation is not strictly blocking the table container.
If the data is embedded in the initial HTML or accessible via a specific query string, the standard 'From Web' feature can pull the table directly.
In Excel, navigate to the 'Data' tab on the ribbon, click 'Get Data', hover over 'From Other Sources', and select 'From Web'.
Paste the target webpage URL into the dialog box and click 'OK'. Wait for Excel to connect to the site.
In the Navigator window, browse through the displayed tables. Check the box next to the table containing your desired data.
Click 'Transform Data' to open the Power Query Editor. Here, you can clean the data, such as removing text units like 'C' or 'MPH' to ensure the columns are numeric. Once clean, click 'Close & Load' to bring the data into your spreadsheet.

Reproduce Form Parameters for JavaScript Postbacks
Use this advanced method if the standard web connector only returns default data because the site relies on HTTP POST requests triggered by JavaScript.
Process and Analyze Your Data Effortlessly with WPS Office
While handling complex JavaScript web scraping may require advanced technical workarounds in Excel, managing and analyzing your successfully extracted data is a breeze with WPS Office. Enjoy a lightweight, highly compatible spreadsheet editor tailored for seamless data formatting and analysis.
- 1. Download and Install: Visit the official WPS Office website to download the free suite and install it on your device.
- 2. Import Your Data: Launch WPS Spreadsheet and easily open your .xlsx or .csv data files containing your web-scraped data.
- 3. Analyze and Format: Use built-in data transformation tools, charts, and pivot features to analyze your extracted datasets efficiently.

Frequently Asked Questions
Why does Power Query not display the data I see on my screen?
The Power Query 'From Web' tool retrieves the initial HTML code sent by the server. If the data you see is rendered dynamically by JavaScript after the page has loaded, Power Query cannot natively execute that script, resulting in missing or default tables.
How do I remove text characters like 'C' or 'MPH' from my imported numbers?
In the Power Query Editor, select the column containing the units, right-click, and choose 'Replace Values' to replace the text with nothing, or use 'Split Column' by non-digit characters. This allows you to change the column data type to a numeric format for analysis.
Can I automate the retrieval of data hidden behind a postback?
Yes, but it requires using the Advanced Editor in Power Query to write custom M-code. You will need to use the Web.Contents function to supply the exact HTTP headers and POST payload that the website's server expects.




