How to invoke python method that uses a non-builtin library (OPENPYXL)

excel
activities
python

#1

Hello all,

We are trying to run a python code (script attached – ExcelTest.py) with UiPath (workflow attached – FuncExcelTest.xaml). We manually import some external libraries to python (eg openpyxl) and, when trying to run the python code manually works but, through UiPath it give us the error “No module named ‘openpyxl’” (attached in the picture C511092.png).

Is there any way we could invoke a python script using non-builtin libraries?

Many thanks in advance!

Find attached the XAML file FuncExcelTest.xaml (7.0 KB)
The python script :

def ExcelFunction(text):
try:
import openpyxl
print(“imported”)
except Exception as inst:
print(str(inst))
return(str(inst))
try:
wb2 = openpyxl.load_workbook(“C:/Users/XXXX/Documents/Python Scripts/hello.xlsx”)
sheet = wb2[“renamed”]
sheet[‘B2’]=“21/07/2018”
wb2.save(“hello.xlsx”)
print(“OK”)
return(text)
except Exception as inst:
print(str(inst))
return(str(inst))

The error: C5110092