Python wriring data from Excel File -
i'm attempting loop through lines of excel file , write data in web application. i'm using mixture of openpyxl excel data , pyautogui click , type in web application. however, when point enter data:
c=sheet.cell(row=i,column=7).value pyautogui.typewrite(c)
i error "for c in message: typeerror: 'int' object not iterable". there way can around this? sounds pyautogui can type exact strings, not read variables?
import openpyxl import pyautogui import time wb = openpyxl.load_workbook('h:\\python transfer.xlsx') type (wb) wb.get_sheet_names() sheet = wb.get_sheet_by_name('sheet1') lastrow = sheet.max_row in range(2,lastrow + 1): #print(sheet.cell(row=i,column=7).value) pyautogui.click(1356,134) time.sleep(5) c=sheet.cell(row=i,column=7).value pyautogui.typewrite(c) time.sleep(2) pyautogui.click(1528,135)
thank you!!
typewrite()
takes string, convert c string:
pyautogui.typewrite(str(c))
see docs: http://pyautogui.readthedocs.io/en/latest/keyboard.html
Comments
Post a Comment