Skip to main content

Greetings;
I’m trying to merge two xlsx files into one csv, using a Python Script, passing a “Month” Value (ex: ‘OCT23’)

Whenever I try to use pandas’ library, I ended up facing a ‘bot error’ in AA.
 

def func_sp(month):
import pandas as pd
nmonth = month

linka = r'PATHTOMYARCHIVE.xlsx'
cam = r'PATH'
arquivo = r'/expensescard_'
formato = ".xlsx"

link = cam + nmonth + arquivo + nmonth + formato
link_do_csv = cam + nmonth + '//'

###'TILL HERE, IT WORKS FINE####

abacartao = pd.read_excel(link, sheet_name=2)
abaclientes = pd.read_excel(link, sheet_name=1)

tel_sp = abaclientes_abaclientese'Número de Contato'].str.contains(r'/(11/)')]
tel_sp)''ID', 'Nome do Cliente', 'Número de Contato', 'Total de Dívidas Mês']]
cart_sp = abacartao 'ID_CLIENTE', 'Empresa Cartao', 'Saldo Final']]

resultado = tel_sp.merge(cart_sp, left_on='ID', right_on='ID_CLIENTE')
resultado.to_csv(link_do_csv + 'GastosClientesSP_' + nmes + '.csv')

return nmonth

 

In EXECUTE FUNCITON action:

Python Session Default
Enter name of funciton to be executed func_sp
Arguments to the function sMonth
Assign the output to variable sPythonFunctionOutput

 

Getting only ‘bot error’ message after running

Be sure to put the import line at the TOP of your Python script, not within the function.


Solved;

Openpyxl installation was missing.


Reply