I am re writing my question with code, First of all I am new to programming. Started to think about programming recently. :( at very later stage of life :)
My code is as below:
import win32com.client as win32
from win32com.client import Dispatch
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open(r'F:\python\book1.xlsx')
excel.Visible = False
ws = wb.Worksheets("Sheet1")
# to get the last row
used = ws.UsedRange
nrows = used.Row + used.Rows.Count
ws.Cells(nrows,2).Value = "21"
ws.Cells(nrows,2).Offset(2,1).Value = "22"
ws.Cells(nrows,2).Offset(3,1).Value = "23"
#like this nine values
wb.Save()
excel.Application.Quit()
What I am trying to do is write values in the excel sheet.
Old Question Below Ignore it. I am using Python 2.7 and win32com to access excel file
I am stuck with a problem where I need to enter data in to 9 cells each time on column B
I want to select the last cell in B column and enter the new set of 9 cell values.
I tried to use ws.usedRange but this is not helping as it chooses the last cell wherever the data is present in the whole sheet. You can see in the attached sheet testdata which is spread in columns D,E,F etc so used range chooses the last cell based on that. is there a way to solve my problem? I am ok to use any other module as well if it helps.