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

s3_read doesn't play nice with openxlsx #16

Closed
Thomas-Hirsch opened this issue Sep 9, 2021 · 2 comments
Closed

s3_read doesn't play nice with openxlsx #16

Thomas-Hirsch opened this issue Sep 9, 2021 · 2 comments

Comments

@Thomas-Hirsch
Copy link

It seem that when trying to read an xlsx file with the openxlsx package doesn't work. botor::s3_read("s3://mybucket/example_file.xlsx", fun=openxlsx::read.xlsx) results in Error: openxlsx can only read .xlsx files

I can confirm that reading the file locally (openxlsx::read.xlsx("example_file.xlsx")) works fine. And readxl's read_xlsx also works with botor. I would probably prefer readxl over openxlsx anyway, but it would be useful to understand why these aren't working nicely together.

@nfultz
Copy link

nfultz commented Sep 9, 2021

I believe this is because openxlsx checks for a file extension on the temp file. See also

https://github.com/ycphs/openxlsx/blob/47df27e6f4fdab4bd51bedb6123881781f00887b/R/readWorkbook.R#L123-L125

and

botor/R/s3.R

Line 105 in 8eb24fa

t <- tempfile()

@daroczig
Copy link
Owner

Thanks for pointing that out, @nfultz!

It sounds like it's not actual bug in botor, so I'm going to close this issue now, especially it works with readxl and the ticket was more about requesting info on the behaviour .. but let me know if you run into a scenario when we need to update how tempfile is called to support custom file extensions.

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

3 participants