Hello,
I am new to RASA and i have a small bot to create that interacts with user, ask a question and stock all these enswers in an Excel file/sheet.
Is it possible with RASA? How can i do it ?
Thank you
Hello,
I am new to RASA and i have a small bot to create that interacts with user, ask a question and stock all these enswers in an Excel file/sheet.
Is it possible with RASA? How can i do it ?
Thank you
Use a FormAction to get all the information you need. Once all information is collected, it runs the ‘submit’-method, where youre free to do whatever you want. In your case, the easiest way is to write a csv-File, which can be easily loaded into Excel.
Thank you for your reply.
As i am new to rasa i might need a little clarification on how to transfer the user input of a slot , add it to a variable , and send it as a parameter to the create CSV class in the actions. If you have any tips or hints i would love to take them.
Your help is much appreciated .
Here’s everything you need
hi, i also wish to know how to add user input into a file, in this case is excel. Have you figure out the way? thanks.
Try to use: pandas.DataFrame.to_csv — pandas 0.25.3 documentation
import os
import pandas as pd
Data = {'Name': ['Rasa'],
'E-mail': ['rasa@rasa.com'],
}
df = pd.DataFrame(Data, columns = ['Name','E-mail'])
if not os.path.isfile('/home/youruse/output1070000.csv'):
df.to_csv('/home/youruse/output1070000.csv',index = False, header='columns')
else: # else it exists so append without writing the header
df.to_csv('/home/youruse/output1070000.csv',index = False, mode='a', header=False)
How can I fetch data from an Excel database or MySQL database in RASA chatbot?
That’s not a specific problem for rasa. You’re pretty much free to write any code in a custom action. So if you know how to do that in python in general you pretty much solved your problem. I have no experience importing from MySQL or Excel in python myself, but I’m absolutely sure, that there are Python packages, which do most of the work you.
You can use pandas to fetch data from excel using custom action. I have done it multiple times.