-2
I need to inform python that if the cell "Relation" is in WHITE, it jumps to the next page and if it is filled it fills with the cell content. The code is working normally when the cell is filled, but it does not work if the cell is empty. Follows code below:
import pyautogui
import pandas as pd
formulario = pd.read_excel(r'C:\formulario.xlsx', sheet_name='Planilha1')
pyautogui.hotkey('alt', 'tab')
#se "Relação" está em branco, pular pra próxima página
if formulario['Relação'] [0] == '' :
pyautogui.hotkey('down')
pyautogui.hotkey('tab')
pyautogui.hotkey('enter')
#se relção está preenchida, preencher com os dados contidos e pular pra proxima página.
elif formulario['Relação'] [0] == 'Mãe/Pai':
pyautogui.hotkey('tab')
pyautogui.hotkey('enter')
pyautogui.sleep(3)
pyautogui.hotkey('tab')
pyautogui.write(str(formulario['Sobrenome'] [0]))
pyautogui.hotkey('tab')
pyautogui.hotkey('enter')
my excel spreadsheet:
```A B
1- Sobrenome Relação
2- Nunes Mãe/Pai```
Then I would like that when the user left the item "Relation" in WHITE the system simply ignored and jumped to the next page.
NOTE: If I put an empty SPACE in the cell and put the code == ' ':
it works. But with blank cell and code == ': This one doesn’t work at all. I have tried: == None: == Nan: == [''']: == [(''')]: == "": == ('''): == is None:
You put the
pandas
as tag. Then I ask: Why you are not using in the methodto_excel()
?– Paulo Marques
I learned using pandas, I don’t know to_excel() how this command would look using it
– G̶e̶r̶a̶l̶d̶o̶ J̶u̶n̶i̶o̶r̶