title: Refresh Excel external data connection using python
body: <p>I have a excel file with external data connection. I need to refresh the connection data using python.</p>
  
  <p>I tried a soultion</p>
  
  <pre><code>import win32com.client
  import os
  fileName="testconn.xlsx"
  xl = win32com.client.DispatchEx("Excel.Application")
  wb = xl.workbooks.open(fileName)
  xl.Visible = True
  wb.RefreshAll()
  wb.Save()
  xl.Quit()
  </code></pre>
  
  <p>But this solution require excel to be installed on the machine.</p>
  
  <p>The another approach i thought was:
  -if some how i get mapping of URLs of data connection and named range in which they are loaded , I can download data from URL and update the data in the named range using openpyxl.</p>
  
  <p>Is there a better way to do this? Does any python library has a a funtionality to retrieve the connection and refresh the connection?</p>
  
  <p>Thanks in advance :)</p>