Skip to content
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

Any plans to incorporate .xlsx files? #272

Open
prasundutta87 opened this issue Oct 14, 2024 · 8 comments
Open

Any plans to incorporate .xlsx files? #272

prasundutta87 opened this issue Oct 14, 2024 · 8 comments

Comments

@prasundutta87
Copy link

Hi,

I was wondering if there are any plans to incorporate to read *.xlsx files or any excel related files?

Regards,
Prasun

@krlmlr
Copy link
Member

krlmlr commented Oct 16, 2024

Oh, that's a neat idea. @cboettig: also something for duckdbfs?

@cboettig
Copy link

duckdbfs is just a thin wrapper that doesn't really do anything itself. However duckdb already supports this (currently by leveraging GDAL via the spatial extension!) so just use open_dataset() with format="sf" and you should be good to go.

https://duckdb.org/docs/guides/file_formats/excel_import.html

@prasundutta87
Copy link
Author

Thanks for this.. How can this be implemented in R specifically?

@cboettig
Copy link

df <- duckdbfs::open_dataset("my_excel.xlsx", format="sf")

@prasundutta87
Copy link
Author

Oh cool! Didn't know duckdbfs was an R package as well! Thanks for this!

@johnmackintosh
Copy link

johnmackintosh commented Oct 17, 2024

Is there a way to specify a specific sheet using the R approach?

@cboettig
Copy link

@johnmackintosh that's a good question. According to https://gdal.org/en/latest/drivers/vector/xls.html it should be opening each sheet as a layer. st_read takes a layer as an argument: https://duckdb.org/docs/extensions/spatial/functions.html#st_read.

But it looks like duckdbfs isn't letting you pass additional arguments to the various read methods, which it definitely ought to do. cboettig/duckdbfs#28

@johnmackintosh
Copy link

@cboettig Thanks. Yes, I did try passing a layer argument, based on the duckdb excel_import docs you linked further up, but no joy. Thanks for looking into this, would be a total game-changer to be able to import a specific sheet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants