title: Password protected excel data to be imported in remote sql server 2008
body: <p>I have an Excel which is protected by password(I know the pwd), I have to import the data from one of the sheets of excel file(.xls) and update one of the tables in the DB located in remote server.  </p>
  
  <p>Following is the dummy code I used.</p>
  
  <pre><code>Declare @ZipTemp NVarchar(255)   
  
  set @ZipTemp = (SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
              'Excel 8.0;Database=C:\Addresses.xls;IMEX=1',
              'SELECT top 1 ZIP FROM [Sheet1$] where ZIP = "328301"'))`
  
  
  Update [dbo].[Addresses_Temp]
  set State = 'CA', Zip = @ZipTemp 
  where Zip = '32830'`
  </code></pre>
  
  <p>but the problem with it is:</p>
  
  <ol>
  <li>It can only be used in local machine server   </li>
  <li>It cannot access password protected files.</li>
  </ol>
  
  <p>Please let me know if anyone knows about it.</p>