title: xlwings: Save and Close
body: <p>I am trying to find out how to save and close to an existing workbook using xlwings after writing in it:</p>
  
  <pre><code>import xlwings as xw
  
  list_of_values = [1, 2, 3]
  workbook_path = 'abc.xlsx'
  wb = xw.Book(workbook_path)
  ws = wb.sheets['sheet1']
  ws.range('E35').value = list_of_values
  wb.save()
  wb.close()
  </code></pre>
  
  <p>When I get to <code>wb.save(workbook_path)</code>, there is a prompt stating:
      'A file named abc.xlsx' already exists in this location. 
      Do you want to replace it?'</p>
  
  <p>I want to overwrite the file immediately without the prompt coming up. According to the docs, <code>wb.save()</code> should automatically overwrite (see: <a href="https://docs.xlwings.org/en/v0.6.4/api.html" rel="noreferrer">https://docs.xlwings.org/en/v0.6.4/api.html</a>). I have also tried <code>wb.save(workbook_path)</code> but the pop-up still appears.</p>
  
  <p>Appreciate any help on this please.</p>
  
  <p>p.s. - I am basically trying to write data into a pre-formatted excel sheet. If there are other ways that can preserve the formatting, I would be happy to try it. I have tried this but it throws an error at <code>if newCell</code>: <a href="https://stackoverflow.com/questions/9920935/easily-write-formatted-excel-from-python-start-with-excel-formatted-use-it-in">Easily write formatted Excel from Python: Start with Excel formatted, use it in Python, and regenerate Excel from Python</a></p>