What is ExcelKnowledgeSource?
ExcelKnowledgeSource bridges business-owned spreadsheets and CrewAI retrieval without forcing analysts through CSV export rituals. Each row (per sheet) is turned into text for embedding, which preserves human-friendly layouts like merged headers until you normalize them. Multi-sheet workbooks are supported, but remember that sheet order and hidden sheets still consume storage if not filtered upstream.
Unlike CSVKnowledgeSource, Excel carries rich types — dates, currency formats, booleans — that should be materialized as readable strings before embedding. If cells rely on volatile formulas, precompute values offline; otherwise agents retrieve `#REF!` strings that look legitimate in cosine space.
Large color-coded workbooks with thousands of styling-only differences still embed as text. Prefer a clean "data" sheet for retrieval and keep narrative tabs out of the file_path list when possible.
When to Use
Spreadsheet data.
Use Cases
- • Pricing sheets
- • FAQ workbooks
Key Features
- ✓ Per-row embedding
- ✓ Multi-sheet
When NOT to Use
Heavy formula models — export computed values to CSV.
Notes
Formula freshness
Linked external workbooks and TODAY() cells change meaning after embedding. Snapshot values when generating the xlsx used for RAG.
PII in spreadsheets
Excel is where emails and employee IDs hide in column Q. Run redaction scripts before indexing or scope the source to agents with proper data clearance.
Binary size vs chunk count
A 5 MB xlsx can still explode into tens of thousands of row embeddings. Prune unused sheets and columns before pointing CrewAI at the file.
Comparison to CSVKnowledgeSource
If collaborators already export clean UTF-8 CSVs on a schedule, CSV ingestion is simpler and more diff-friendly in git. Choose Excel when business users insist on xlsx workflows.
Import
from crewai.knowledge.source.excel_knowledge_source import ExcelKnowledgeSource
Key Parameters
| Parameter | Type | Default | Purpose |
|---|---|---|---|
| file_path | str | — | Workbook path. |
Code Examples
Load a pricing workbook
from crewai.knowledge.source.excel_knowledge_source import ExcelKnowledgeSource
src = ExcelKnowledgeSource(file_path='finance/prices.xlsx')
Agent with Excel + string policy
from crewai import Agent, Task, Crew, Process
from crewai.knowledge.source.excel_knowledge_source import ExcelKnowledgeSource
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
sheet = ExcelKnowledgeSource(file_path='ops/runbook.xlsx')
policy = StringKnowledgeSource(content='Always cite sheet name when answering.')
agent = Agent(role='Ops', goal='Answer runbook questions', backstory='Use both sources.', knowledge_sources=[sheet, policy])
Crew(agents=[agent], tasks=[Task(description='How do we fail over region {region}?', expected_output='Steps', agent=agent)], process=Process.sequential).kickoff(inputs={'region': 'eu-west'})
Crew-wide Excel corpus
from crewai import Crew, Agent, Task, Process
from crewai.knowledge.source.excel_knowledge_source import ExcelKnowledgeSource
src = ExcelKnowledgeSource(file_path='catalog/products.xlsx')
writer = Agent(role='Writer', goal='Draft copy', backstory='Ground claims in catalog rows.')
Crew(agents=[writer], tasks=[Task(description='Describe SKU {sku}', expected_output='Marketing blurb', agent=writer)], knowledge_sources=[src], process=Process.sequential).kickoff(inputs={'sku': 'SKU-900'})
Common Mistakes
❌ Indexing a template workbook with empty example rows
✅ Filter to populated rows or maintain a dedicated data sheet without placeholders.
ExcelKnowledgeSource FAQ
What is ExcelKnowledgeSource in CrewAI?
Loads xlsx workbooks (one row per chunk by default). ExcelKnowledgeSource bridges business-owned spreadsheets and CrewAI retrieval without forcing analysts through CSV export rituals. Each row (per sheet) is turned into text for embedding, which preserves human-friendly layouts like merged headers until you normalize them. Multi-sheet workbooks are supported, but remember that sheet order and hidden sheets still consume storage if not filtered upstream. Unlike CSVKnowledgeSource, Excel carries rich types — dates, currency form…
Which package defines the CrewAI class ExcelKnowledgeSource?
DevShelfHub maps ExcelKnowledgeSource to Python module crewai.knowledge.source (package path crewai.knowledge.source in this reference). Pin your installed crewai version and match imports to the snippet on this page.
When should I use ExcelKnowledgeSource?
Spreadsheet data.
When should I avoid using ExcelKnowledgeSource?
Heavy formula models — export computed values to CSV.
How do I import ExcelKnowledgeSource in Python?
from crewai.knowledge.source.excel_knowledge_source import ExcelKnowledgeSource
Where can I explore more CrewAI API reference pages?
Open the CrewAI API reference index on DevShelfHub to search 58 classes, 30 methods, and 16 decorators, each with runnable examples, parameters, common mistakes, and cross-links.