Export data from Python to spreadsheet I have written the following code to export to data to a spreadsheet with this result: 

Please let me know how to improve it.

import numpy as np
import xlwt #THIS MAY BE GOOD
#from pandas import DataFrame

amin =2
amax=10
da = 2
names = ['amin', 'amax', 'da']
values = [amin, amax, da]

fname='EXPORTexample.xls'; sheetname = 'sheet 1'

book = xlwt.Workbook()
sh = book.add_sheet(sheetname)

col=0;
# FIRST WRITE THE VARIABLES AND THEIR VALUES INTO XLSX.
for row, (name, value) in enumerate(zip(names, values)):
    sh.write(row, col, name);
    sh.write(row, col+1, value); 

t2 = np.arange(0.0, 5.0, 1)
amat= np.arange(amin,amax,da)

fn=np.zeros((np.shape(t2)[0],1))

col=3;
#row_eps =0;
#row_Dt += row_eps;

for a in amat:
    fn = a*t2

    names = ['eps_dot', 'Delta_t']
    values=[a*1., a*1.]  
    #write specific a conditions on every data curve/set   
    for row, (name, value) in enumerate(zip(names, values)):
        sh.write(row, col, name);
        sh.write(row, col+1, value); 

    #write names such as strain, stress, d11s, d_dot, d11
    occ_rows = len(names)#no.of occupied rows. 
    names = ['strain', 'stress', 'd11s', 'd_dot', 'd11']
    for cols,name in enumerate(names):
        sh.write(occ_rows+1, col+cols, name)

    ## WRITE actual numbers
    for rows, (strain_i,stress_i, d11s_i, d_dot_i, d11_i) in enumerate(zip(fn, t2, fn, t2, fn)):

        sh.write(occ_rows+1+rows+1, col, strain_i)    
        sh.write(occ_rows+1+rows+1, col+1, stress_i)    
        sh.write(occ_rows+1+rows+1, col+2, d11s_i)    
        sh.write(occ_rows+1+rows+1, col+3, d_dot_i)    
        sh.write(occ_rows+1+rows+1, col+4, d11_i)    

    col+=6 #incremening column value to avoid overwriting and related error

book.save(fname)
First you should clean up your code - add whitespace, remove unnecessary comments, don't use semicolons, store repeated computations in variables, move repeated code fragments into functions, etc.  

Second, if at all possible give them more descriptive names - I have no idea what this is about.  A good way to do this is to figure out the different sections (you have them labelled with comments) and then turn each section into a well-named, small function. This way you can clearly document what each section does and why, without having to add comments that clutter everything up. Prefer expressing yourself in code over in comments whenever possible.  Some people even consider writing comments a shameful act - I don't personally go that far, but here are some good articles about it:  


https://blog.codinghorror.com/coding-without-comments/  
https://visualstudiomagazine.com/articles/2013/06/01/roc-rocks.aspx


Robert C Martin talks a lot about this - I'd highly recommend reading his work.


  Comments are, at best, a necessary evil, nothing to celebrate
  The proper use of comments is to compensate for our failure
  to express ourself through the code itself
  http://www.cvc.uab.es/shared/teach/a21291/temes/coding_style/slides/comments.pdf


Third, use the right data structure for the job. Anytime you have name-value pairs and you aren't using a dictionary you're probably doing something wrong.  Whenever you have a list but you never mutate it, you should make it a tuple.

Fourth, if you use the start keyword argument to enumerate you can get rid of a lot of extra code. You can then compress your data curves section pretty easily.

Once you've moved things into some nice clean functions, you can then put your runtime code into an if __name__ == '__main__' block.

Last, I'd make a wrapper that turns your workbook into a context manager. This way you can make sure that the workbook is saved, and it makes things quite a bit cleaner.

You might also want to consider adding support for command line arguments, making it easier to generate a lot of sheets like this that operate on different parameters.

I ended up with something like this

import numpy as np
import xlwt 
import contextlib


def write_to_sheet(sheet, row, column, name, value):
    sheet.write(row, column, name)
    sheet.write(row, column + 1, value)

def write_variables(sheet, variables):
    write_dict(sheet, 0, variables)

def write_conditions(sheet, column, conditions):
    write_dict(sheet, column, conditions)

def write_dict(sheet, column, dict_):
    for row, (name, value) in enumerate(dict_.items()):
        write_to_sheet(sheet, row, column, name, value)

def write_data_curve(sheet, data_curve, start_row, start_column):
    for column, (header, data) in enumerate(data_curve.items(), start=start_column):
        sheet.write(start_row, column, header)
        for row, value in enumerate(data, start=start_row + 1):
            sheet.write(row, column, value)

def write_data_curves(sheet, amin, amax, da):
    t2 = np.arange(0.0, 5.0, 1)
    amat = np.arange(amin, amax, da)
    col = 3

    for a, fn in ((a, a * t2) for a in amat):
        conditions = {
            'eps_dot': a * 1.,
            'Delta_t': a * 1.
        }
        write_conditions(sheet, col, conditions)

        data_curve = {'strain': fn, 'stress': t2,
                      'd11s': fn, 'd_dot': t2,
                      'd11': fn}
        write_data_curve(sheet, data_curve, len(conditions) + 1, col)

        col += 6

@contextlib.contextmanager
def open_book(filename):
    workbook = xlwt.Workbook()
    yield workbook
    workbook.save(filename)   


if __name__ == '__main__':
    amin = 2
    amax = 10
    da = 2

    variables = {
        'amin': amin,
        'amax': amax,
        'da': da
    }

    with open_book('EXPORTexample.xls') as book:
        sh = book.add_sheet('sheet 1')
        write_variables(sh, variables)
        write_data_curves(sh, amin, amax, da))