title: Python - Using pyodbc to connect to remote server using info from Excel data connection
body: <p>I have an excel (albeit, one that's on our company server) that has a data connection to our SQL database so we can make nice pivot tables.</p>
  
  <p>I would like to get that data into python (on my local computer) so I can do some faster analysis.</p>
  
  <p>I have installed pyodbc.</p>
  
  <p>Here is the "connection string" from the excel:</p>
  
  <pre><code>Provider=SQLOLEDB.1;Password=**mypassword**;Persist Security Info=True;User
  ID=**myusername**;Initial Catalog=**catalogename**;Data 
  Source=**datasourcename**;Use Procedure for Prepare=1;Auto 
  Translate=True;Packet Size=4096;Workstation ID=**workstationid**;Use 
  Encryption for Data=False;Tag with column collation when possible=False
  </code></pre>
  
  <p>and now I have the python script:</p>
  
  <pre><code>import pyodbc
  cnxn = pyodbc.connect(DRIVER='{SQL Server}',SERVER='***server ip address**',DATABASE='**cataloguename**',UID='**myusername**',PWD='**mypassword**')
  cursor = cnxn.cursor()
  </code></pre>
  
  <p>and I am getting errors saying that SQL Server does not exist or access denied.</p>
  
  <p>Any help is greatly appreciated. </p>