Fix Excel Power Query SQL Server Pre-Login Handshake Timeouts
Question details
Resolve a pre-login handshake timeout when Excel Power Query connects to a database that is reachable through SQL tools.

- Product
- Microsoft Excel Power Query and SQL Server
- Device & OS
- not provided
- Scenario
- A user connects to a SQL Server database through Excel Power Query after successfully connecting through a SQL tool.
- Observed behavior
- The Power Query connection fails during the pre-login handshake, even though a SQL tool can connect to the database.
Record the exact error message and compare the server name, port, authentication method, and encryption settings used by Excel and the working SQL tool. If possible, run both tests from the same device and network.
Compare the SQL Server connection and security settings
Use this approach first when a SQL tool connects successfully but Excel Power Query does not.
In Excel, open Data > Queries & Connections, right-click the affected query, and select Edit. In Power Query Editor, review the Source step and confirm the server and database match the working SQL tool.
In Excel, open Data > Get Data > Data Source Settings. Select the SQL Server source and review its permissions and credentials; update them if they differ from the intended connection.
In the SQL tool's connection settings, note the server address, port, encryption, and certificate settings. Ask the database administrator to verify that Excel's connection can reach the same endpoint and that the server's TLS configuration and certificate are valid.
Ask the SQL Server administrator to review SQL Server and system logs for the time of the failed attempt. Include the exact Excel error and the results of the comparison with the working SQL tool.

Review Power Query connection and command timeouts
Use this when connection setup is slow or when the query runs for a long time after connecting.
Work with Excel Files in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and compatibility with Microsoft Excel formats for easier migration. It does not repair Excel Power Query or SQL Server handshake errors.

Frequently Asked Questions
Why can my SQL tool connect when Excel Power Query cannot?
The applications may use different server names, ports, drivers, credentials, or encryption settings. Compare the SQL tool's connection settings with the Source step in Power Query Editor and test from the same device and network.
Will increasing CommandTimeout fix a pre-login handshake error?
Usually not by itself. CommandTimeout controls query execution after a connection is established. For a pre-login failure, investigate connection timeout, network access, TLS, and server-side logs.
Where can I check the Power Query connection settings?
In Excel, open Data > Queries & Connections, right-click the query, and select Edit. Inspect the Source step or open Home > Advanced Editor to review the Sql.Database options.
Should I set the SQL command timeout to zero?
In custom SQL application code, SqlCommand.CommandTimeout = 0 means no command timeout. Use it only when the workload warrants an unlimited wait, and do not treat it as a fix for a pre-login handshake failure.




