Find answers from the community

Updated 6 months ago

Is it possible to import a csv file and

At a glance

The community member is asking if it is possible to import a CSV file and treat each line as a separate document, resulting in an object with as many documents as there are lines in the CSV file. In the comments, another community member suggests using the PagedCSVReader from the llama-index library, providing a link to the relevant code example. Another community member expresses gratitude for the suggestion.

Useful resources
Is it possible to import a csv file and use every single line as a single document? So that after reading that file I would have a object with as many documents as there was lines in the CSV file?
a
o
W
4 comments
oh cool, thank you so much
You can use PagedCsv reader from llamaindex: https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/paged_csv/base.py


Just need to install the reader package and import it.

pip install llama-index-readers-file
Import it like
from llama_index.readers.files.paged_csv import PagedCSVReader
Add a reply
Sign up and join the conversation on Discord