I use the code below to transfer scraped data to excel sheet. It works, but the downside is the execution time. It takes around 5-10 seconds to transfer approx 200 rows x 2 columns (400 elements) that way. I was hoping, that someone could hint me with some more efficient solution.
Python code:
driver=webdriver.Chrome(executable_path=r'C:/chromedriver.exe')
driver.get('https://www...table')
First = driver.find_elements_by_xpath('//table[@id="cr1"]/tbody/tr/td[1]')
Second = driver.find_elements_by_xpath('//table[@id="cr1"]/tbody/tr/td[2]')
xlapp = win32.Dispatch('Excel.Application')
wbook = xlapp.Workbooks.Open(r'Test.xlsm')
sheet = wbook.Worksheets('COMM')
for i in range(len(First)):
sheet.Cells(i,1).Value = First[i]
sheet.Cells(i,2).Value = Second[i]