How to Manage Excel SQL Connection Strings and User Authentication
Question details
Users need to understand how to manage permissions, credentials, and privacy settings when an Excel workbook connects to a SQL Server database view.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Connecting an Excel workbook to a SQL Server view to retrieve and refresh data.
- Observed behavior
- Users require valid Windows or database credentials to refresh data, and data connection privacy settings must be managed to securely share workbooks.
Ensure you have the correct SQL Server hostname, database name, and valid login credentials provided by your database administrator before configuring the connection.
Configure Data Source Settings in Power Query
Update or clear your SQL Server connection credentials to ensure smooth data refresh and appropriate access for your queries.
When connecting to an external database, Excel caches your credentials. If your password changes or another user needs to refresh the data, these credentials must be updated within Power Query.
Open your workbook, navigate to the 'Data' tab on the ribbon, and select 'Get Data' followed by 'Data Source Settings'.
Locate your SQL Server connection in the list of data sources, click to highlight it, and select 'Edit Permissions'.
Under the 'Credentials' section, click 'Edit' to enter your valid Windows or Database credentials.
Select the appropriate Privacy Level (such as Organizational or Private) from the dropdown, then click 'Save' and 'Close'.

Secure Data Connections and Restrict Sharing
Prevent unauthorized users from viewing or modifying underlying SQL queries by applying workbook protection.
Manage External Data Connections Easily with WPS Spreadsheet
WPS Spreadsheet provides a highly compatible and intuitive interface for importing data, managing external connections, and securing your worksheets.
- 1. Open WPS Spreadsheet: Launch WPS Spreadsheet and navigate to the 'Data' tab on the main ribbon.
- 2. Import External Data: Click on 'Import Data' to establish a new connection to your external SQL database or data source.
- 3. Configure Connection: Input your server credentials and configure the data refresh settings according to your business needs.
- 4. Secure Your File: Use the 'Review' tab to protect your workbook structure before sharing it with your team.

Frequently Asked Questions
Why am I getting a 'Login failed' error when refreshing Excel data?
This typically occurs if your Windows or database credentials have changed or expired. Go to Data > Get Data > Data Source Settings, select your database from the list, and update your credentials.
How do I hide the SQL query connection string from other users?
To prevent users from viewing or editing the connection string, you can disable the connection properties or protect the entire workbook structure from the Review tab before distributing the file.
Do other users need SQL Server permissions to view my Excel file?
Users can view the static data already loaded into the workbook without SQL permissions. However, if they need to click 'Refresh All' to pull the latest data from the server, they must possess valid SQL Server credentials.
What are privacy levels in Power Query data connections?
Privacy levels (Public, Organizational, Private) determine how data can be isolated or combined from multiple sources. This prevents sensitive internal data from being inadvertently exposed during complex query operations.




