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

Add option to specify file format to support Shiny fileInput() #85

pofigster opened this Issue Apr 20, 2015 · 5 comments


None yet
6 participants

pofigster commented Apr 20, 2015

When a file is loaded through a fileInput() widget in a Shiny app, it appears that read_excel scans the file name to determine the file type (at least when input$file[,4] - the file path) is used. Shiny uploads an extension-less temporary file so read_excel can't open the file.


This comment has been minimized.

Nihasa commented Apr 22, 2015

Hi, I ran into this problem as well and my current workaround is as follows:

                      paste(inFile$datapath, ".xlsx", sep=""))
                    paste(inFile$datapath, ".xlsx", sep=""), 1)

it's not the cleanest but it works.


This comment has been minimized.

andrewcstewart commented May 16, 2015

thanks for the workaround @Nihasa


This comment has been minimized.

faidherbard commented Jun 1, 2015

This is not specific to readxl, I ran into the same issue with readr when I wanted to read_csv a zipped CSV file. readr does it right in my R scripts when it has the extension, but it fails with the extension-less temporary file uploaded by Shiny.

jirkalewandowski added a commit to jirkalewandowski/readxl that referenced this issue Jun 28, 2015


This comment has been minimized.

0tertra commented Jul 13, 2015

to ensure that the user does upload an .xlsx file, or you need to check the extension you're self to switch between read functions. You can extract the extension as following:

update: instead of file.copy() file.rename() can be used.

ext <- tools::file_ext(inFile$name)
                   paste(inFile$datapath, ext, sep="."))
 read_excel(paste(inFile$datapath, ext, sep="."), 1)

This comment has been minimized.

zross commented Aug 20, 2015

I agree that adding the ability to feed read_excel() the extension would be useful, particularly in Shiny where the filename from fileInput drops the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment