'Python pandas read and write value in excel - excel sheet formula removed after write data

I have using python pandas read and write value in script. My Excel spreadsheet using vlookup formula apply when run the script read value full name and password then write value Status column "passed" or "failed" write that time next cell change the read value manually but automatically vlookup remove all cells.

import pandas as pd

df = pd.read_excel('data.xlsx')

for i in df.index:
    entry = df.loc[i]

    name_input = driver.find_element(By.XPATH, "//*[@class='full name'])
    name_input.send_keys(entry['full name'])

    password_input = driver.find_element(By.XPATH, "//*[@class='password'])

    password_input.send_keys(entry['password'])

    try:

        driver.find_element(By.XPATH, "//*[class='sign out']")
        print("passed")
        df['status'] = 'passed'
    except NoSuchElementException:
        try:
             driver.find_element(By.XPATH, "//*[class='login']")
             print("failed")
             df['status'] = 'failed'
         except NoSuchElementException:
             pass   
    
df.to_excel('data.xlsx', index=False, header=True)




Sources

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

Source: Stack Overflow

Solution Source