I have a Shiny app that uses the read.xlsx
function from package xlsx
. All works fine, but I want to change to read_excel
from readxl
, hoping it would be faster and able to cope with large files.
ui part:
fileInput("inputFile","Upload file...")
server part:
data <- reactive({
inFile <- input$inputFile
if (is.null(inFile)) { return(NULL) }
dataFile <- read_excel(inFile$datapath,sheet=1)
return(dataFile)
})
I get the "Unknown format" error.
inFile$datapath is "/tmp/.../60974676c7287e913d1c0dc5/0"
inFile$type is "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Question 1: is there a way to tell read_excel
that it's a xlsx type file?
Question 2: is it possible to control the location where the uploaded file will be stored?