How to choose an alternative name for sheet in xls file from python?
<p>I want to transfer my data from python to excel file in various sheets. So I need to change the name of the sheet to choose the proper sheet to write on. I have written this code but it does not accept me to give an alternative name to my sheet in <code>ws = wb.add_sheet("Patch Size %s",%(wo))</code> line. </p>

<pre><code>patch = [3, 5, 7, 9, 11, 13, 15, 17, 19, 25, 37, 49, 55, 60, 70, 80]

DATA = (("x", 1,),
        ("x",1),
        ("x",1),
        ("x",1 ),
        ("x",1 ),
        ("x",1 ),
        ("x",1 ),
        ("x",1 ),
        ("x",1 ),
        ("x", 1),
        ("x",1 ),
        ("x",1 ),
        ("x",1 ),
        ("x",1 ),
        ("x", 1),
        ("x",1),)

whch = 25
wb = xlwt.Workbook()
w0 = 0 
while whch != patch[w0]:
    w0 = w0+1
ws = wb.add_sheet("Patch Size %s",%(wo))
for i, row in enumerate(DATA):
    for j ,col in enumerate(row):
        if j == 0:
            ws.write(i, j, col)
        elif j == 1:
            ws.write(i, which+j, col)
ws.col(0).width = 456 * max([len(row[0]) for row in DATA])
</code></pre>

<p>Do you know how I can do that?</p>

<p>Thanks.</p>