title: Save excel workbook in Python
body: <p>I am new in Python and I need to open all Excels in a folder (one by one), wait some time for SAS addin to load new data, then save it and close it. I tried to use some libraries, but I cant obtain the expected result.</p>
  
  <p>Using subprocess:</p>
  
  <pre><code>import os
  import subprocess
  
  path = "C:\\Users\\...\\Desktop\\TEST_EXCEL"
  
  for file in os.listdir(path):
      filename = os.path.join(path, file)
      if filename.endswith(".xlsx"):    
         proc = subprocess.Popen([filename], shell=True)
         time.sleep(60)
         subprocess.call(['taskkill', '/F', '/T', '/PID', str(proc.pid)])
  </code></pre>
  
  <p>Popen function open the Excel, then I wait 60 seconds, so the addin can load the data, and then close it. The problem is I cannot save the new data that was added.</p>
  
  <p>I also tried with other libraries like openpyxl, but I was not able to open the Excel. I load Excel but it seems that it is not downloading new data if you dont open it.</p>
  
  <p>Example with openpyxl:</p>
  
  <pre><code>import os
  import openpyxl
  
  path = "C:\\Users\\...\\Desktop\\TEST_EXCEL"
  
  for file in os.listdir(path):
      filename = os.path.join(path, file)
      if filename.endswith(".xlsx"):    
         wb = openpyxl.load_workbook(filename)
         time.sleep(60)
         wb.save(filename)
  </code></pre>
  
  <p>Thanks for your help.</p>