title: Modifying Excel using xlrd and xlwt
body: <p>I am creating a new excel from an existing excel . There ares <code>3 Sheets</code> in my old excel say <code>first</code> , <code>second</code> , <code>third</code>. I am able to copy the contents of first sheet succesfully in new excel which is based on some condition i.e my code before <code>while index &lt; 3 :</code> works perfectly fine . For sheet <code>second</code> and <code>third</code> I want to copy them as they are in <code>original excel sheet</code>. But When the copy starts for <code>second</code> sheet I get an error :- </p>
  
  <pre><code>sheet1 = w.add_sheet('Info')
  File "/usr/local/lib/python2.7/site-packages/xlwt/Workbook.py", line 331, in add_sheet
  raise Exception("duplicate worksheet name %r" % sheetname) 
  </code></pre>
  
  <p>My code is as follows:-</p>
  
  <pre><code>newexcel = "newexcel.xls"
      count = 0
      wb = xlrd.open_workbook('/home/sam/myexcel.xls')
      w = Workbook()
      sheet = w.add_sheet('Input_Resource')
      index = 0
      s = wb.sheet_by_index(index)
      if index &lt; 1 :
          index =+ 1
          for row in range(s.nrows):
              coln =0
              val = s.cell(row,coln).value
              if val in MissingId :
                  mylist.append(val)
                  count += 1
              else:
                  for col in range(s.ncols):
                      val = s.cell(row,col).value
                      sheet.write(row-count,col,val)
      while index &lt; 3 :
          if index == 1 :
              sheet1 = w.add_sheet('Info')
          else :
              sheet2 = w.add_sheet('Sheet3')
  
          s = wb.sheet_by_index(index)
          index =+ 1
          for row in range(s.nrows):
              coln =0
              val = s.cell(row,coln).value
              for col in range(s.ncols):
                  val = s.cell(row,col).value
                  if index == 1:
                      sheet1.write(row,col,val)
                  else :
                      sheet2.write(row,col,val)
  w.save(newexcel)
  </code></pre>
  
  <p>Any Help or hint is appreciated :)</p>