nacnudus / tidyxl

Read untidy Excel files in R https://nacnudus.github.io/tidyxl/
https://nacnudus.github.io/tidyxl/
Other
248 stars 21 forks source link

How to import data from a URL? #76

Closed marine-ecologist closed 2 years ago

marine-ecologist commented 2 years ago

Not an issue as much as a question, but: Is it possible with tidyxl to import xlsx files from a URL as with read.csv? For example:

cells <- xlsx_cells("https://www.seanoe.org/data/00400/51167/data/51949.xlsx")

nacnudus commented 2 years ago

Unfortunately not. An xlsx file is in fact a zipped directory of files. Tidyxl uses R's utils::unzip() to extract what it needs, and unzip() doesn't support URLs. RStudio has recently created an alternative unzip() https://github.com/r-lib/zip but it too only supports local files. The readr package also can't read zip files from URLs, and nor can readxl, although they are thinking about how to do it. It's clearly possible to do, just fiddly. I'd welcome a PR.