I am not totally sure I do understand you, but you can create a reactive dataframe from shiny::fileInput, see below. Why do you need a separate actionButton?
library(shiny)
library(reactable)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fileInput("file1", "Choose CSV File", accept = ".csv"),
checkboxInput("header", "Header", TRUE)
),
mainPanel(
reactableOutput("table")
)
)
)
server <- function(input, output) {
datatable <- reactive({
file <- input$file1
ext <- tools::file_ext(file$datapath)
req(file)
validate(need(ext == "csv", "Please upload a csv file"))
read.csv(file$datapath, header = input$header)
})
output$table <- renderReactable({
reactable(datatable())
})
}
shinyApp(ui, server)