title: Reading and updating sheets in an XLSM file using pandas while preserving the VBA code
body: <p>I have a requirement to read an xlsm file and update some of the sheets in the file. I want to use pandas for this purpose.</p>
  <p>I tried answers presented in the following post. I couldn't see the VBA macros when I add the VBA project back.<br />
  <a href="https://stackoverflow.com/posts/28170939/revisions">https://stackoverflow.com/posts/28170939/revisions</a></p>
  <p>Here are the steps I tried,</p>
  <p>Extracted the VBA_project.bin out of the original.xlsm file and then</p>
  <pre><code>writer = pd.ExcelWriter('original.xlsx', engine='xlsxwriter')
  workbook = writer.book
  workbook.filename = 'test.xlsm'
  workbook.add_vba_project('vbaProject.bin')
  writer.save()
  </code></pre>
  <p>With this I don't see the VBA macros attached to &quot;test.xlsm&quot;. The result is the same even if I write it to the &quot;original.xlsm&quot; file.</p>
  <p>How do I preserve the VBA macros or add them back to the original xlsm file?</p>
  <p>Also, is there a way I can open the &quot;xlsm&quot; file itself rather than the &quot;xlsx&quot; counterpart using <code>pd.ExcelWriter</code>?</p>