title: Python ExcelWriter How to write data to different columns in different sheets
body: <p>I want to append the vectors to different excel columns at different sheets. The code is:</p>
  <pre><code>import numpy as np
  import pandas as pd
  
  for i in range(3):
      for j in range(2):
          with pd.ExcelWriter('test.xlsx', mode='a+', engine='openpyxl') as writer:
              x = np.random.rand(10, 1)
              x = pd.DataFrame(x)
              x.to_excel(writer,
                         sheet_name=f'Sheet{j}',
                         startcol=i,
                         index=False,
                         header=False)
              writer.save()
  </code></pre>
  <p>The outer <code>i</code> loop determines the index of column to insert, and the inner <code>j</code> loop determines which sheet to write to. But this doesn't work. Only Sheet1 is shown and only one column has data inserted. It seems in every loop a new sheet is created regardless the sheet with the same name exists.
  How to solve this problem?</p>