I am able to find the last row and i have my variable set, however i'm getting this error: This object does not support enumeration
## Export Severity to Qualy Data ##
## access excel application and open active worksheet ##
Excel = win32.gencache.EnsureDispatch('Excel.application')
Excel.Visible = False
wb = Excel.Workbooks.Open('Qualys Data.xlsx')
sh = wb.ActiveSheet
## Find last row ##
lastRow = sh.UsedRange.Rows.Count
next_Row = lastRow+1
print("Next row to print: ", next_Row)
## Can i loop through the document, if on last_Row / print to last row?
for line in sh:
if desired_row == next_Row:
sh.Range("A1:A1").Value = reportDate
print("Exporting to data to new spreadsheet...")
time.sleep(1)
Excel.DisplayAlerts = 0
wb.SaveAs('Qualys Data.xlsx')
Excel.DisplayAlerts = True
Excel.Quit()
Basically I want to write to the last row if on the last row, next_Row will print the row number to write to