The error "The download has failed" appears when Excel attempts to refresh data using a web query or Power Query’s Web.Contents engine, but the remote server terminates the connection, drops the request, or returns an unhandled response. This indicates that Excel reached out across your network adapter, but the remote web server rejected the request before data could be parsed.
Fast Fix
Open Data > Queries & Connections, right-click the failing query, and choose Edit. Verify the URL opens normally in your web browser. If it does, go to Data Source Settings, select the URL, click Clear Permissions, and re-authenticate. If connecting to a public website, add a custom
User-Agentheader in the Power Query Advanced Editor.
Diagnostic Snapshot
| Property | Details |
|---|---|
| Error Message | The download has failed / DataSource.Error: The download has failed |
| Underlying Protocol | HTTP / HTTPS (GET/POST) |
| Common Triggers | Missing User-Agent headers, expired corporate credentials, URL redirects, TLS version mismatches. |
| Scope | Can affect legacy Excel Web Queries (.iqy), IMPORTXML, and Power Query Web.Page/Web.Contents. |
Primary Causes and Diagnostic Steps
1. The Remote Server Blocks Excel’s Default User-Agent
Many modern web servers and Content Delivery Networks (CDNs like Cloudflare or Akamai) block automated requests that use generic user-agent strings. When Excel issues a refresh request, it identifies itself with a default Microsoft Office user-agent, which bot-protection systems frequently drop.
Resolution: Supply a Browser User-Agent in M-Code
- In Excel, select Data > Queries & Connections.
- Right-click the affected query and select Edit to launch the Power Query Editor.
- In the Home tab, click Advanced Editor.
- Locate the
Web.ContentsorWeb.Pagestep. - Add a standard browser
User-Agentinside the request header record:
let
Source = Web.Page(
Web.Contents(
"<https://www.example.com/data-table>",
[
Headers = [
#"User-Agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
]
]
)
),
Data = Source{0}[Data]
in
Data
- Click Done and click Close & Load.
2. Expired or Invalid Data Source Permissions
If the target webpage requires an account, an expired session token cached in Excel will cause the server to return an HTTP 401 or 302 redirect to a login screen, which manifests in Excel as a failed download.
Resolution: Flush and Re-enter Credentials
- Navigate to Data > Get Data > Data Source Settings.
- Choose Global permissions.
- Locate the root domain of the failing site.
- Click Clear Permissions (or Delete).
- Close the dialog, click Data > Refresh All, and select the appropriate credential type (Anonymous, Basic, or Organizational account) when prompted.
[Data Source Settings]
└── Select: <https://targetsite.com>
└── [Clear Permissions]
└── Trigger Refresh -> Select Authentication Method
If your credentials repeatedly drop after closing Excel, review How to Resolve “Credential persistence” Errors in M365 Excel.
3. Legacy Web Query (.iqy) Deprecation
If your workbook uses legacy web queries created via the older From Web (Legacy) interface or imported .iqy files, modern security baselines in Microsoft 365 may silently drop the connection, particularly if the destination site enforces modern authentication or TLS 1.3.
Resolution: Modernize the Query
- Copy the target URL from your legacy connection.
- Go to Data > Get Data > From Other Sources > From Web.
- Paste the URL, set the access level, and select the specific HTML
<table>or JSON element needed. - Delete the legacy connection under Data > Queries & Connections.
4. TLS Mismatch and Corporate Proxy Interception
In corporate environments, SSL/TLS inspection firewalls can intercept secure web traffic. If the proxy issues an intermediate certificate that the local Office credential store does not trust, the download fails instantly.
Diagnostic Check:
- Attempt to refresh the query while disconnected from your corporate VPN or zScaler/Cisco umbrella client.
- If the refresh succeeds off-network, the network proxy is dropping the non-interactive Excel traffic.
- Contact IT to whitelist the target URL or bypass SSL inspection for Excel’s network process.
If the refresh continues to fail and returns specific HTTP response codes rather than a generic download failure, cross-reference “DataSource.Error: Web.Contents failed to get contents” (500 Internal Error). If the DNS resolution itself is failing, see “Data Source.Error: The remote name could not be resolved”.