How to insert values of a whole column in python using xlwt
Question: I have found the intersection of two columns in the same excel sheet and I
would like to write the result in a third column in the same sheet using xlwt,
how do I do it? I post the code I am working with below.

    
    
    import xlrd
    import xlwt
    
    
    wb=xlrd.open_workbook('try2.xls')
    xlsname = 'try2.xls'
    book = xlrd.open_workbook(xlsname, on_demand=True)
    sheet0=book.sheet_by_name('one')
    A = sheet0.col(0)
    B = sheet0.col(1)
    C = sheet0.col(2)
    D = sheet0.col(3)
    E = sheet0.col(4)
    F = sheet0.col(5)
    W = E and F
    

How do I write W in `G = sheet0.col(6)`? Thanks!!


Answer: HOW to insert a column before specified column in excel sheet using python

    
    
        import win32com.client
        xlApp = win32com.client.Dispatch("Excel.Application")
    

Open excel sheet

    
    
        wkbk = xlApp.Workbooks.Open("C:\\Sunil\\myexcel.xlsx")
    

Activcate the sheet you want by number

    
    
        wksht = wkbk.Sheets(1)
    

Activcate the sheet you want by name

    
    
        wksht = wkbk.Worksheets("Sheet2").Activate()
    
        wksht = wkbk.Worksheets("Sheet1").Activate()
    

Take the object of activated sheet

    
    
        wksht = wkbk.ActiveSheet;
    

insert column before Column B

    
    
        wksht.Columns("B").EntireColumn.Insert()
    

