Compatibility: Only available on Node.js.
CSVLoader document loaders. For detailed documentation of all CSVLoader features and configurations head to the API reference.
This example goes over how to load data from CSV files. The second argument is the column name to extract from the CSV file. One document will be created for each row in the CSV file. When column is not specified, each row is converted into a key/value pair with each key/value pair outputted to a new line in the document’s pageContent. When column is specified, one document is created for each row, and the value of the specified column is used as the document’s pageContent.
Overview
Integration details
| Class | Package | Compatibility | Local | PY support |
|---|---|---|---|---|
| CSVLoader | @langchain/community | Node-only | ✅ | ✅ |
Setup
To accessCSVLoader document loader you’ll need to install the @langchain/community integration, along with the d3-dsv@2 peer dependency.
Installation
The LangChain CSVLoader integration lives in the@langchain/community integration package.
Instantiation
Now we can instantiate our model object and load documents:Load
Usage, extracting a single column
Example CSV file:API reference
For detailed documentation of all CSVLoader features and configurations head to the API reference.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.