duckdb / duckdb/duckdb-excel

Add filename as parameter to read_xlsx

Open
#67 0 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
62
Forks
24
PR merge metrics
No merged PRs in 30d

Description

The read_xlsx function does not allow you to add the file name as a column.
This would be useful in cases where data is included in the file name, especially when reading multiple files like this:

file_2025-06.xlsx.
file_2025-07.xlsx
file_2025-08.xlsx.

It would be very useful to have the same functionality as the read_csv function with filename=true, which outputs a filename column.

Example:
https://duckdb.org/docs/stable/data/multiple_files/overview.html

Read the CSV files flights1.csv and flights2.csv, unifying schemas by name and outputting a filename column:

SELECT *, filename
FROM read_csv(['flights1.csv', 'flights2.csv'], union_by_name = true, filename = true);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the read_xlsx entry point and compare its behavior with read_csv when filename=true. Verify how multiple files are handled, then confirm that read_xlsx accepts the requested option and produces a filename column for each input file, as shown in the issue's SQL example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.