How to invoke a python script that read excel file

Good day all,

Please, I am having an error with Invoke Python Method activity. I was able to load my python script but my bot is throwing an error at Invoke Python Method activity.
Below is the error message I got.
Invoke Python Method: One or more errors occurred.
Below is my python script:
import pandas as pd

def main(filePath):
df = pd.read_excel(filePath)
with pd.ExcelWriter(filePath, mode=‘a’, engine=‘openpyxl’, if_sheet_exists=‘new’) as writer:
df.to_excel(writer, sheet_name=‘Sheet2’, index=False)

Note: filePath is my input parameter I am passing in.

@Gbenga_Odelade

Please open the locals panel in debug mode and expand the exception details you would see more details of what exactly is the issue and from there we can take next steps based on the error you need

Cheers

Out of curiosity why are you doing this instead of just using the activities for reading an Excel file? They’re simple.

Check if pandas is installed in the machine the bot is running.

Thanks all. The issue has been resolved.
I had to install openpyxl.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.