Fast, parallel Excel (XLSX) loading with low memory overhead.
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL sheetreader FROM community;
LOAD sheetreader;
Example
-- Install and load the extension
INSTALL sheetreader FROM community; LOAD sheetreader;
-- Read an Excel spreadsheet
SELECT * FROM sheetreader('data.xlsx');
-- Read a specific worksheet
SELECT * FROM sheetreader('data.xlsx', sheet_name = 'Sales');
-- Load a spreadsheet in parallel into a table
CREATE TABLE data AS
FROM sheetreader('data.xlsx', threads = 8);
About sheetreader
SheetReader enables fast, memory-efficient loading of Excel (XLSX) spreadsheets through specialized parsing routines and parallel processing. Unlike conventional XML-based Excel parsers, it is optimized for spreadsheet data, improving runtime and memory efficiency especially for large spreadsheets, as shown in our research paper and recent benchmarks.
Available Parameters
| Parameter | Description | Type | Default |
|---|---|---|---|
sheet_index |
Index of the worksheet to read (starting at 1). Cannot be combined with sheet_name. |
INTEGER |
1 |
sheet_name |
Name of the worksheet to read. Cannot be combined with sheet_index. |
VARCHAR |
"" |
threads |
Number of threads used for parallel parsing. | INTEGER |
Half of available cores (minimum 1) |
skip_rows |
Number of rows to skip before reading. | INTEGER |
0 |
has_header |
Require the first row to be usable as column headers. When false, SheetReader still attempts to use the first row as headers but does not fail if it cannot. | BOOLEAN |
false |
types |
Column types (VARCHAR, BOOLEAN, DOUBLE, DATE), one per column. |
LIST(VARCHAR) |
Inferred from the first two rows after skipped rows |
coerce_to_string |
Coerce cells in VARCHAR columns to strings. |
BOOLEAN |
false |
force_types |
Enforce specified types even if they conflict with inferred types; incompatible cells become NULL or are converted to strings when coerce_to_string is set. |
BOOLEAN |
false |
Background
SheetReader was developed as part of the PolyDB research project. Our research introduced a spreadsheet-specialized parser designed for use across multiple systems, including integrations for PostgreSQL, Python/pandas, R data frames, and DuckDB (see the SheetReader core repository).
If SheetReader was helpful in your research, please consider citing our paper:
@article{GavriilidisHZM23,
author = {Haralampos Gavriilidis and Felix Henze and Eleni Tzirita Zacharatou and Volker Markl},
title = {SheetReader: Efficient Specialized Spreadsheet Parsing},
journal = {Information Systems},
volume = {115},
pages = {102183},
year = {2023},
doi = {10.1016/j.is.2023.102183}
}
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| sheetreader | table | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |