File Data
Load data from files in your vault. Supports CSV, JSON, Parquet, and Markdown tables.
Supported Formats
| Format | Extension | Best For |
|---|---|---|
| CSV | .csv | Spreadsheet exports, tabular data |
| JSON | .json | Structured data, nested objects |
| Parquet | .parquet | Large datasets, data engineering |
| Markdown | .md | Tables in other notes |
CSV Files
The most common format for tabular data:
markdown
```dg
type: bar
data:
file: data/sales.csv
x: product
y: revenue
title: Product Revenue
```Example CSV (data/sales.csv):
csv
product,revenue,quarter
Laptops,125000,Q1
Phones,210000,Q1
Tablets,89000,Q1CSV parsing automatically:
- Detects headers from first row
- Converts numeric strings to numbers
- Handles quoted fields with commas
JSON Files
For structured or nested data:
markdown
```dg
type: treemap
engine: d3
data:
file: data/org-chart.json
hierarchy:
id: name
parent: parent
value: size
```Example JSON (data/org-chart.json):
json
[
{"name": "Company", "parent": null, "size": 0},
{"name": "Engineering", "parent": "Company", "size": 50},
{"name": "Sales", "parent": "Company", "size": 30}
]Parquet Files
High-performance columnar format:
markdown
```dg
type: scatter
data:
file: data/large-dataset.parquet
x: feature_1
y: feature_2
color: category
```Parquet files are read using the hyparquet library.
Markdown Tables
Reference a table from another note:
markdown
```dg
type: bar
data:
file: Projects/Q4 Report.md
table: 0 # First table in the file
x: project
y: budget
```The source file should contain a standard Markdown table:
markdown
| project | budget | status |
|---------|--------|--------|
| Alpha | 50000 | active |
| Beta | 35000 | active |
| Gamma | 20000 | done |File Paths
Paths are relative to your vault root:
yaml
# Root level
data:
file: data.csv
# Subfolder
data:
file: data/sales/2024-q1.csv
# Spaces in paths work
data:
file: "My Data/Sales Report.csv"Configuration Options
| Option | Type | Description |
|---|---|---|
file | string | Path to file |
table | number | Table index for Markdown files (0-based) |
sheet | string | Sheet name for multi-sheet formats |
Examples
Time Series from CSV
markdown
```dg
type: line
data:
file: data/daily-metrics.csv
x: date
y: pageviews
title: Daily Traffic
```Hierarchical from JSON
markdown
```dg
type: sunburst
engine: d3
data:
file: data/budget-breakdown.json
hierarchy:
id: category
parent: parent
value: amount
```Tips
Organize Files: Create a
data/folder in your vault for all data files.
Version Control: If you use git with your vault, data files are version controlled too.
Performance: For files over 10,000 rows, DataGlass automatically optimizes rendering.
Common Mistakes
Wrong: Absolute paths
yaml
data:
file: /Users/me/Documents/data.csv # Won't workRight: Vault-relative paths
yaml
data:
file: data/sales.csvWrong: Forgetting quotes for paths with spaces
yaml
data:
file: My Data/report.csv # ErrorRight: Quote paths with spaces
yaml
data:
file: "My Data/report.csv"See Also
- Inline Data - Embed data directly
- URL Data - Load from external sources
- Vault Queries - Query data from notes