-
Notifications
You must be signed in to change notification settings - Fork 99
Data Explorer: Add support for opening .xlsx files #7366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1570,6 +1570,12 @@ export class DataExplorerRpcHandler { | |
const query = `CREATE OR REPLACE TABLE ${catalogName} AS | ||
SELECT * FROM parquet_scan('${virtualPath}');`; | ||
await this.db.runQuery(query); | ||
} else if (baseExt === '.xlsx') { | ||
await this.db.runQuery('INSTALL excel FROM core_nightly;'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this "phones home" to load the extension from duckdb.org (http://nightly-extensions.duckdb.org, see https://duckdb.org/docs/stable/extensions/installing_extensions.html), it might fail in some environments where Positron isn't able to access the public internet, but that seems like an acceptable caveat until we sort out how to bundle supported DuckDB extensions with Positron to avoid installing from the internet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, good callout. |
||
await this.db.runQuery('LOAD excel;'); | ||
await this.db.runQuery( | ||
`CREATE OR REPLACE TABLE ${catalogName} AS SELECT * FROM read_xlsx('${virtualPath}');` | ||
); | ||
} else { | ||
await importDelimited(virtualPath); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on a dev version here feels a bit icky to me, however the last non-dev release of duckdb-wasm, 1.29.0, was October 2024, so the next release may not be for a while. I can ask the duckdb folks what they think about shipping a dev version to production to see. I also just learned about https://duckdb.org/docs/stable/clients/node_neo/overview.html which would enable us to get off of wasm altogether which might be a preferable path