title: Copy excel sheet from one worksheet to another in Python
body: <p>All I want to do is copy a worksheet from an excel workbook to another excel workbook in Python.</p>
  
  <p>I want to maintain all formatting (coloured cells, tables etc.)</p>
  
  <p>I have a number of excel files and I want to copy the first sheet from all of them into one workbook. I also want to be able to update the main workbook if changes are made to any of the individual workbooks.</p>
  
  <p>It's a code block that will run every few hours and update the master spreadsheet.</p>
  
  <p>I've tried pandas, but it doesn't maintain formatting and tables.</p>
  
  <p>I've tried openpyxl to no avail</p>
  
  <p>I thought xlwings code below would work:</p>
  
  <pre><code>import xlwings as xw
  
  wb = xw.Book('individual_files\\file1.xlsx')
  sht = wb.sheets[0]
  new_wb = xw.Book('Master Spreadsheet.xlsx')
  new_wb.sheets["Sheet1"] = sht
  </code></pre>
  
  <p>But I just get the error:</p>
  
  <pre><code>----&gt; 4 new_wb.sheets["Sheet1"] = sht
  
  AttributeError: __setitem__
  </code></pre>
  
  <p>"file1.xlsx" above is an example first excel file. </p>
  
  <p>"Master Spreadsheet.xlsx" is my master spreadsheet with all individual files.</p>