How to make Python change xlsx files when Excel app is opened?
<p>Sorry if I ask a question that may have been asked before but I could not really find the answer in Google and Stack Overflow forums.</p>

<p>Question is connected with <code>openpyxl</code> usage as it is the most convenient library which works with <code>xlsx</code> files. </p>

<pre><code>    import openpyxl

    wb = openpyxl.load_workbook("D:/Python.xlsx")
    sheet = wb.active

    i = 0

    sheet["A1"] = i

    wb.save("D:/Python.xlsx")
</code></pre>

<p>However, it does not work with an opened excel file. I get an error</p>

<pre><code>    [Errno 13] Permission denied: 'D:/Python.xlsx'
</code></pre>

<p>I also found similar questions:</p>

<p><a href="https://stackoverflow.com/questions/31147460/permissionerror-errno-13-when-running-openpyxl-python-script-in-komodo">PermissionError [errno 13] when running openpyxl python script in Komodo</a></p>

<p><a href="https://stackoverflow.com/questions/26141114/write-to-an-open-exceldocument">write to an open exceldocument</a></p>

<p>What can I do to solve this error and make Python work with an opened file in Excel? My current version is Python 2.7. Also, if possible, what is the solution of making the same magic in <code>xlsm</code> files?</p>

<p>UPD:</p>

<p>If there is no solution for the first question (except Google Docs maybe, thanks to @Alex), is it possible to write a code which makes the following algorithm perform:
1. Close an Excel app and save
2. Do staff in python, and save the results in some destination in Excel
3. Open Excel file in Excel app? </p>

<p>I know how to do 2. Any thoughts on 1 and 3?</p>

<p>UPD2:</p>

<p><code>xlwings</code> really does awesome job! Just what I needed! Thanks!</p>

<p>I want to provide a code that worked for me (just other users can find in Google and use):</p>

<pre><code>   import xlwings as xl
   import time

   wb = xl.Workbook.active()
   sheet = wb.active

   iter = 10
   i = 0

   while True:
    i += 1
    if i &lt;= iter:
     xl.Range("A1").value = i
     time.sleep(1)
     print(i)
    else:
     break

  wb.save()
  print("Done!")
</code></pre>