Shiny App database upload

Hello, I was trying to use a shiny app and refer in the UI to a database that I upload on the server side but I can't find a way to do it.
The way I upload it is as follows:

tableData <- reactive({
inFile <- input$file1

if (!is.null(inFile)){
} else {

what exactly is your problem, is it that you see only mtcars, or do you get read_excel complaining ?

This should work:
I added a table to see the results.
inFile contains a bit more than just the name of the file (see the print(inFile) result in the console, so it's better to adress it not with inFile, but with "input$file1$datapath" in the read_excel.


# Define UI for application that draws a histogram
ui <- fluidPage(
    titlePanel("Testing Shiny"),
    # Sidebar with a slider input for number of bins 
            fileInput("file1", "Please upload your Excel file here!")
        # Show a table of the data

# Define server logic required to draw a histogram
server <- function(input, output) {

    tableData <- reactive({
        inFile <- input$file1
        if (is.null(inFile)){
            importeddata = mtcars
            # you could remove  the "importeddata = " but if you want to do more on the file it's better to store it somewhere.
        } else {
            importeddata = read_excel(input$file1$datapath)           
    output$table1 = renderTable(tableData())

# Run the application 
shinyApp(ui = ui, server = server)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.