title: list index out of range in python
body: <pre><code>import glob
  import xlrd
  
  from xlwt import Workbook
  
  wb = Workbook()
  
  for file_name in glob.glob("foo*.xls"):
      wb_orig = xlrd.open_workbook(file_name)
      for ws_orig in wb_orig.sheets():
          ws = wb.add_sheet('{0} {1}'.format(file_name, ws_orig.name))
          for rx in range(ws_orig.nrows):
              for cx in range(ws_orig.ncols):
                  ws.write(rx, cx, ws_orig.cell_value(rx,cx))
  
  wb.save("mefoo.xls")
  </code></pre>
  
  <p>i tried the above code in many ways to merge multiple excel sheets into one workbook........
  this code gives error as </p>
  
  <pre><code>Traceback (most recent call last):
    File "E:\my python\Internship\mergestackoverflow.py", line 16, in &lt;module&gt;
      wb.save("mefoo.xls")
    File "C:\Python27\lib\site-packages\xlwt\Workbook.py", line 634, in save
      doc.save(filename, self.get_biff_data())
    File "C:\Python27\lib\site-packages\xlwt\Workbook.py", line 615, in get_biff_data
      self.__worksheets[self.__active_sheet].selected = True
  IndexError: list index out of range
  </code></pre>
  
  <p>please help me to solve the error..</p>