title: How to write df to sheet while overwriting existing data?
body: <p>I'm currently using Pandas to write a dataframe to a specific sheet, but it doesn't delete the 'old' data. It just writes on top of it.</p>
  <p>This means if my dataframe is 5 rows, but the old data is 10 rows. Then I will overwrite the first 5 rows, but the old data remains in the remaining rows.</p>
  <p>How can I modify this code to overwrite to the whole specified sheet?</p>
  <p>I have data from a report feeding from the sheet, so I cannot delete rows or create a new sheet unfortunately.</p>
  <pre><code>book = load_workbook(workbookname)
  writer = pd.ExcelWriter(workbookname, engine='openpyxl')
  writer.book = book
  writer.sheets = dict((ws.title, ws) for ws in book.worksheets)
  df.to_excel(writer, &quot;SheetName&quot;)
  
  writer.save()
  </code></pre>