I included a Python Script to my Automation Anywhere 360 Bot but when running the bot, nothing happens. This means that I don't get an error message. I run the bot on my local device where Python is installed. The environment variables are set correct (checked with cmd).
The code is pretty simple.
import pandas as pd
import numpy as np
import os
import openpyxl
def excel_split():
excel = pd.read_excel("some excel.xls")
column_name = 'Name'
unique_values = excel[column_name].unique()
for unique_value in unique_values:
df_output = excel[excel[column_name].str.contains(unique_value)]
output_path = os.path.join('file path in another folder', unique_value + '.xlsx')
df_output.to_excel(output_path, index=False)
print(excel_split())
So basically the Python Script takes an Excel I created in my bot before and then splits the Excel based on a column. Afterwards, the splitted Excel files get saved into another folder. The Scripts works well when executing in Visual Studio Code. But as described previously, nothing happens. The error must be within Python because when I do some testing with a simple function which gives back some text, it works. Example:
def greet():
return 'Hello A360! from Python'
print(greet())
Then I print it out via Message box.
I'm happy about any hints!
If I'm not mistaken, seems like you just forgot to use
return <output>in your function. In python if you don't usereturnexplicitly it just defaults toreturn None, hence why you're not seeing anything