title: How to write two sheets in a single workbook at the same time using openpyxl
body: <p>I have to create and write a new excel workbook with about 5 worksheets. The purpose of my code is to read a database and split that into different sheets depending on certain criterion.</p>
  
  <p>I have used the following code in python 2.7 using openpyxl-1.1.0</p>
  
  <pre><code>from openpyxl.workbook import Workbook
  dest_filename = 'D:\\Splitted.xlsx'
  
  wb = Workbook()
  ws1 = wb.worksheets[0]
  ws1.title = 'Criterion1'
  
  ws2 = wb.worksheets[1]
  ws2.title = 'Criterion2'
  
  ## Read Database, get criterion
  if criterion == Criterion1:
      ws1.cell('A1').value = 'A1'
      ws1.cell('B1').value = 'B1'
  elif criterion == Criterion2:
      ws2.cell('A1').value = 'A2'
      ws2.cell('B1').value = 'B2'
  
  wb.save(filename = dest_filename)
  </code></pre>
  
  <p>I am able to write single sheet, but if I try to create 2nd worksheet, I am getting an error saying "Index out of range" at code
      ws2 = wb.worksheets[1]</p>
  
  <p>Is there any solution to write 2 or more worksheets in a single workbook at the same time?</p>