Forum Discussion
ValueError: Error downloading data: ProxyError in Python in Excel (Microsoft 365)
"Hello,
I am experiencing a persistent error when trying to retrieve data from the web using the Python in Excel feature (part of Microsoft 365).
The Issue: When executing any Python code within an Excel cell that attempts an HTTP/HTTPS request (e.g., using the requests library), an error occurs. The specific error message is: ValueError: Chyba při stahování dat: HTTPSConnectionPool(host='...') Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request')))
Key Observations and Steps Taken (please review each point):
- Python in Excel Feature: This issue specifically affects the Python in Excel add-in within Microsoft 365.
- Consistent Error: The error occurs consistently for any target URL, whether it's https://www.oddsportal.com/ or a simple test page like https://quotes.toscrape.com/ (which is known for easy scraping tests and does not have active protections like Cloudflare).
- OS Proxy Settings Excluded:
- All proxy settings in Windows (Automatic proxy setup, Use setup script, Manual proxy setup) are Disabled.
- The issue is not related to browser proxy settings.
- Network Connection Excluded:
- The error persists even when connecting via a mobile hotspot, ruling out the home network (Virgin Media) as the cause.
- Firewall Excluded:
- Windows Defender Firewall has been temporarily disabled for all network profiles during testing, and the error still occurs.
- No other third-party antivirus or firewall software is installed (only Windows Defender).
- Microsoft Office Reinstallation:
- Microsoft 365 has been completely reinstalled on the laptop, which did not resolve the issue.
- Network Reset:
- A "Network Reset" has been performed in Windows, which reinstalls network adapters and resets network settings. This also did not resolve the issue.
- System File Check:
- sfc /scannow was run from an elevated command prompt and found and successfully repaired corrupted system files. However, the ProxyError still persists after a restart.
- DISM /Online /Cleanup-Image /RestoreHealth was also run.
- Creative Cloud:
- It was observed that Creative Cloud performed a self-repair/update after running system file checks, but this did not resolve the network error in Excel.
- Task Manager Observation:
- Reviewing Task Manager processes shows no obvious third-party proxy-like processes running that would explain the error.
Conclusion:
Given these comprehensive troubleshooting steps, it appears to be a deeply embedded system-level issue affecting how Python within Excel handles outbound HTTPS requests, manifesting as a ProxyError despite no active proxy being configured. The Tunnel connection failed: 400 Bad Request part of the error suggests an unexpected interception or failure at a low level of the network stack, or within the Python in Excel environment itself.
Any assistance or advanced diagnostic steps would be greatly appreciated."