Excel 2007/2010/2016从网页获取外部数据时脚本报错崩溃求助
I’ve seen this exact problem dozens of times with Excel’s legacy web import tool—let’s dig into why it’s breaking and how to fix it for good.
Why You’re Seeing Script Errors & Crashes
Excel’s old "Get External Data from Web" feature relies on the Internet Explorer rendering engine (even in newer Excel versions like 2016). Modern sites like the one you mentioned use complex JavaScript that IE’s outdated engine can’t handle smoothly. Every time the engine hits a JS snippet it doesn’t understand, it throws that "script error" popup, and Excel hangs because it’s stuck waiting for IE to finish processing the page.
Actionable Fixes to Try
1. Silence the Script Error Popups (First Quick Win)
Since Excel uses IE under the hood, adjusting IE’s settings can stop those annoying popups:
- Open Internet Explorer (yes, even if you never use it), go to Tools > Internet Options > Advanced.
- Under the "Browsing" section:
- Check Disable script debugging (Internet Explorer) and Disable script debugging (Other).
- Uncheck Display a notification about every script error.
- Apply the changes, restart Excel, and those popups should vanish. This won’t fix the freezing entirely, but it’ll make the process less frustrating.
2. Switch to Power Query (The Modern, Reliable Alternative)
If you’re on Excel 2010 or later, Power Query (called "Get & Transform Data" in 2016+) is the way to go. It uses a modern web scraper that handles JS-heavy sites way better than the legacy tool:
- For Excel 2010: Enable the Power Query add-in via your Excel’s Add-ins menu (or install it through your Office account if it’s missing).
- For Excel 2016+: Head to the Data tab, click Get Data > From Web.
- Enter your URL, and Power Query will let you pick exactly the tables you need without triggering IE’s script errors. It’s also way more flexible for cleaning and transforming data after import.
3. Target Only the Data You Need
If you can’t switch to Power Query, reduce the load on Excel by importing only the specific table instead of the entire page:
- When using the legacy "From Web" tool, after entering the URL, use the "Select Tables" step to pick just the table you want. This cuts down on the amount of HTML/JS Excel has to parse, lowering the chance of crashes.
- Bonus: Check if the site offers a direct data feed (like CSV or JSON) for the info you need—importing that directly into Excel will be far more stable than scraping the web page.
4. Repair Your Office Installation
Corrupted Office files can cause random stability issues:
- Open Control Panel > Programs > Programs and Features.
- Find Microsoft Office, right-click it, select Change > Quick Repair (use Online Repair if Quick doesn’t resolve the issue).
- Let the repair finish, restart your PC, then test the import again.
Final Thoughts
The legacy "Get External Data from Web" tool is really showing its age—it was built for simpler web pages, not the JS-heavy sites we use today. Power Query is the official replacement, and it’ll solve most of these stability problems long-term.
内容的提问来源于stack exchange,提问作者drb01

