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

Extend support for extensionless files #342

Closed
stephlocke opened this Issue Apr 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@stephlocke

stephlocke commented Apr 17, 2017

  1. It'd be nifty if read_excel() will try the lower level functions if it does not detect an extension
  2. More importantly, excel_sheets() needs support for extensionless files
@jennybc

This comment has been minimized.

Member

jennybc commented Apr 17, 2017

Reminding myself of context: Shiny will strip file extension (although I hold on to some hope that this will change one day rstudio/shiny#1501). So there is no easy way for Shiny app developer to take advantage of the new functions read_xls() or read_xlsx(). Because they don't know if its xls or xlsx. The workaround is to try read_xlsx() and catch the error, in which case try again with read_xls(). That doesn't help with excel_sheets(), though.

@jennybc

This comment has been minimized.

Member

jennybc commented Apr 19, 2017

Detect format with something along these lines (suggestion from @jimhester):

## https://en.wikipedia.org/wiki/List_of_file_signatures
readBin(no_ext_xls, n = 8, what = "raw")
#> [1] d0 cf 11 e0 a1 b1 1a e1
readBin(no_ext_xlsx, n = 4, what = "raw")
#> [1] 50 4b 03 04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment