How To Fill Excel File From Selenium Scraping In Loop With Python
i am trying to scrape a website than contain many pages, with selenium i open each time a page in second 'TAB' and launch my function to get the data. after that i close the tab an
Solution 1:
To append excel data using Pandas, you need to set the worksheets in the writer object.
Update the last section in your code:
#save the data in excel filefrom openpyxl import load_workbook
book = load_workbook(path)
startrw = book['Sheet1'].max_row+1
writer.book = book
writer.sheets = dict((ws.title, ws) for ws in book.worksheets) # prevent overwrite
df.to_excel(writer, sheet_name='Sheet1',startrow=startrw, header=False)
writer.save()
return soup
Post a Comment for "How To Fill Excel File From Selenium Scraping In Loop With Python"