N
noydb
How can you determine the next open row in an existing Excel file such
that you can start adding data to the cells in that row? As in below,
I want a variable in place of the 6 (row 6 in the four ws1.Cells(x,1)
lines), but have no other way of knowing what row I am on besides
looking to the first free cell in column A. How to do? Examples I
see make it seem really complicated - this can't be that hard.
Thanks for any help.
worksheet = "C:\\Excel_Reports\\ea" + ea + "report"# + ".xls"
xlApp = win32com.client.Dispatch("Excel.Application")
xlApp.Visible = 1
xlApp.Workbooks.Open(worksheet) ## for existing file
##xlApp.SheetsInNewWorkbook = 1
##wb = xlApp.Workbooks()
ws1 = xlApp.Worksheets(1)
ws1.Cells(6,1).Value = "selection"
ws1.Cells(6,2).Value = count
ws1.Cells(6,3).Value = epcFloat
ws1.Cells(6,8).Value = currentGMT
wb.SaveAs(worksheet)
wb.Close(False) ## False/1
that you can start adding data to the cells in that row? As in below,
I want a variable in place of the 6 (row 6 in the four ws1.Cells(x,1)
lines), but have no other way of knowing what row I am on besides
looking to the first free cell in column A. How to do? Examples I
see make it seem really complicated - this can't be that hard.
Thanks for any help.
worksheet = "C:\\Excel_Reports\\ea" + ea + "report"# + ".xls"
xlApp = win32com.client.Dispatch("Excel.Application")
xlApp.Visible = 1
xlApp.Workbooks.Open(worksheet) ## for existing file
##xlApp.SheetsInNewWorkbook = 1
##wb = xlApp.Workbooks()
ws1 = xlApp.Worksheets(1)
ws1.Cells(6,1).Value = "selection"
ws1.Cells(6,2).Value = count
ws1.Cells(6,3).Value = epcFloat
ws1.Cells(6,8).Value = currentGMT
wb.SaveAs(worksheet)
wb.Close(False) ## False/1