'Sync Issues Inputting Excel Data with Openpyxl with MS OneDrive

I have a script which scrapes some data from a few websites, and then inputs that data into an excel sheet in the form of a log. The problem I am having is that this excel file is regularly used by many other people within my company, and often someone will be in the file at the time. This is fine if I go in and have 'auto-save' turned on. Everything syncs together and people can make changes.

However, if I use my script to go into the file using openpyxl and input the data which was scraped, it almost always leads to a sync error when I open the file and a requirement to delete the updated version of the file.

Does anyone know a way around this?

Nothing complex in terms of the actual code:

#Put results in Log
ws.cell(column=1, row=newRowLocation, value='=DATEVALUE("' + yesterday + '")')
ws.cell(column=2, row=newRowLocation, value='NAME')
ws.cell(column=3, row=newRowLocation, value=int(SCRAPED_DATA))


wb.save(filename=THE_FILE)
wb.close()


Solution 1:[1]

You can try with regular method of tagname

from selenium import webdriver
from webdriver_manager.microsoft import EdgeChromiumDriverManager

driver = webdriver.Edge(EdgeChromiumDriverManager().install())
driver.get("http://localhost/rpa_anomaly/test.php")
# identify elements with tagname <a>
lnks = driver.find_elements_by_tag_name("a")
# traverse list
for lnk in lnks:

    print(lnk.get_attribute("href"))
driver.quit()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1