botor icon indicating copy to clipboard operation
botor copied to clipboard

`s3_read` doesn't play nice with `openxlsx`

Open Thomas-Hirsch opened this issue 4 years ago • 1 comments

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.

Thomas-Hirsch avatar Sep 09 '21 14:09 Thomas-Hirsch

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

https://github.com/daroczig/botor/blob/8eb24fa7f0102fbc88d9941dc097cb4016c930e5/R/s3.R#L105

nfultz avatar Sep 09 '21 15:09 nfultz