Excel sheet prompting for SQl Login Credentials

18,170

I have solved it using the following the steps.

  1. Create a user in SQL Server and give permission to that user for the desired database.
  2. Open Excel->Click on "Data" Tab
  3. Click on Existing Connection.A pop up will appear.
  4. On the top of the pop up window, you find "Connections in this Workbook". Right click on it.
  5. Click on Edit Connection Property.
  6. Connection Property Pop up will Appear.Click on the "Definition" tab on the Connection Property Pop up.
  7. Edit the connection string and Add User id and password in the connection string and mention the User id and password you had created on step 1.
Share:
18,170
Dharmendra
Author by

Dharmendra

Updated on June 12, 2022

Comments

  • Dharmendra
    Dharmendra almost 2 years

    I Have an Excel Sheet where i had created an pivot table which is taking data from Sql Table.I am downloading that Excel sheet from an Application to Client machine and when we try to open it in clint machine, it is asking for the SQl Server Login Credentials. Is there any way so that after downloading to client machine the sheet will not prompt for SQL Login Credentials and we will hardcode or Set in Excel itself. The User just open or download and as he open the pivot the Datasourse will not prompt for SQl Login and Refresh the Datasource automatically.

    • Turbot
      Turbot about 12 years
      can you use excel macro to have the credential set?
    • Dharmendra
      Dharmendra about 12 years
      How to set credential from Excel Macro as i dont know much about it.
  • Fandango68
    Fandango68 about 4 years
    Sorry, but that is not a proper work-around. What if clients don't want to give you their password? What if you don't want to give users direct access to the database, which anyone could Google ways to access using other means, such as ODBC directly?
  • Fandango68
    Fandango68 about 4 years
    The proper solution is to give TRUST in Excel's Options. I'll let you google that one
  • maleficent
    maleficent almost 4 years
    Definitions tab in my excel workbook is greyed out. How do I save password?