title: Excel data sometimes does not refresh using python
body: <p>Having sometimes issues with my excel. That data is refreshed using Python script:</p>
  
  <pre><code>try:
          current_date = datetime.date.today()
          deadline= datetime.date.today()+ timedelta(days=1)
          current_date_delta = current_date+datetime.timedelta(days=1)
  
          from win32com.client import Dispatch
          Application = Dispatch("Excel.Application")
          Application.Visible = 0
          Application.DisplayAlerts = False
          Workbook = Application.Workbooks.Open('\\\\files\\MY_FILE.xlsb')
          Application.Run('Refresh')
          Workbook.Save()
          Workbook.SaveAs('\\\\files\\MY_FILE_UPD '+ str(current_date)+'.xlsb')
          Workbook.Close()
          Application.Quit()
  except:
      log_error()
  </code></pre>
  
  <p>However,
  This scripts does not work time to time(not always,random) at it gives that error. So what can cause that sometimes script works and sometimes it does not? 
  That excel file is not opened by somebody else while script is running.</p>
  
  <blockquote>
    <p>ERROR:root:2016.11.04 09.49 Traceback (most recent call last):   File
    "debts2.pyw", line 39, in 
        Application.Run('Refresh')   File "", line 14, in Run   File
    "C:\Anaconda\lib\site-packages\win32com\client\dynamic.py", line 282,
    in <em>ApplyTypes</em>
        result = self.<em>oleobj</em>.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args) com_error: (-2147023170, 'The remote
    procedure call failed.', None, None)</p>
  </blockquote>