# How can I extract data from a CSV file into my RASA chatbot?

**URL:** https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071
**Category:** Rasa Open Source
**Created:** [May 28, 2021, 12:02pm UTC](https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071 "2021-05-28T12:02:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Razvan](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Razvan](https://forum.rasa.com/u/Razvan)
#### Post date: [May 28, 2021, 12:02pm UTC](https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071/1 "2021-05-28T12:02:13Z")

</div>

I am developing a RASA chatbot, and I want to have a table (csv file) with fields like : book, year, points, author. How can I extract the data from that CSV file into my RASA chatbot? For example if I ask the chatbot: In what year Percy Jackson and The Lightning Thief was published? Answer: 2006 (answer provided from the CSV file) or Who’s the author of the Intelligent Investor book? Answer: Benjamin Graham (also from my CSV file) or How many points does [that book] have? Answer: 100 points (from CSV)

How can I implement something like this ?

---

<div class="post-metadata">

### Author: ![Aciel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/aciel/32/12939_2.png) [@Aciel](https://forum.rasa.com/u/Aciel)
#### Post date: [June 3, 2021, 4:45pm UTC](https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071/2 "2021-06-03T16:45:11Z")

</div>

Hello @Razvan and welcome to the forum!

Try implementing this using a `form` and a `custom action`. The `form` allows you to fill all the necessary slots (book, year, points, and author) inveractively with the user, and the `custom action` allow you to load and query the csv file using the filled slots. Custom actions are implemented using python, so you can use `pandas` to load the csv as a dataframe and query it.

Here are some references:

- Forms: [docs](https://rasa.com/docs/rasa/forms) and [video tutorial](https://www.youtube.com/watch?v=U3an88fjFRc)

- Custom actions: [docs](https://rasa.com/docs/rasa/custom-actions) and [video tutorial](https://www.youtube.com/watch?v=rvHg7N8ux2I&t=38s)

I hope this helps.

Aciel

---

<div class="post-metadata">

### Author: ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)
#### Post date: [June 27, 2021, 10:30pm UTC](https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071/3 "2021-06-27T22:30:23Z")

</div>

@Razvan Heya! Are you able to solve this?

---

<div class="post-metadata">

### Author: ![Razvan](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Razvan](https://forum.rasa.com/u/Razvan)
#### Post date: [June 28, 2021, 8:51am UTC](https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071/4 "2021-06-28T08:51:53Z")

</div>

Yup, i figured it out

---

<div class="post-metadata">

### Author: ![mpriya-sv](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/mpriya-sv/32/16712_2.png) [@mpriya-sv](https://forum.rasa.com/u/mpriya-sv)
#### Post date: [August 30, 2021, 2:46pm UTC](https://forum.rasa.com/t/how-can-i-extract-data-from-a-csv-file-into-my-rasa-chatbot/44071/5 "2021-08-30T14:46:31Z")

</div>

Hi, Can you please help me with how you defined the custom action to read & extract data from the CSV?
