Hi @vinayprakash808. You may try to use insertUI to generate the number of fileInput as follow.
library(shinydashboard)
library(readxl)
library(shiny)
out <- data.frame(baseFns = ls('package:base'))
ui <- dashboardPage(
dashboardHeader(title = "Loading data"),
dashboardSidebar(sidebarMenu(
menuItem("Load Data", tabName = "Load_Data", icon = icon("balance-scale")),
menuItem("Analysis", tabName = "Analysis", icon = icon("chart-bar"))
)),
dashboardBody(
tabItems(tabItem(tabName = "Load_Data", numericInput("T", "No of data sets", value = 1, min = 1, width = 150),
# textInput("T", "No of data sets", value = 0,width = 150),
fluidRow(
tags$div(id = "container")
# box(fileInput("datafile","Choose the csv file",multiple = TRUE,
# accept = c("text/csv","text/comma-separated-values,text/plain",".csv")),width = 2)
),
fluidRow(box(title = "Dataset",uiOutput("filter_70"),width = 5000)))
))
)
server <- function(input,output){
observe({
req(input$T)
removeUI("#fileInputContainer")
insertUI("#container", "afterBegin", tags$div(id = "fileInputContainer"))
for(i in 1:input$T) {
insertUI("#fileInputContainer", "beforeEnd",
box(fileInput(paste0("dataFile", i), "Choose the csv file",
accept = c("text/csv","text/comma-separated-values,text/plain",".csv")),width = 2))
}
})
# output$contents <- renderTable({
# file_to_read <- input$datafile
# if(is.null(file_to_read))
# return(NULL)
# a <- read.csv(file_to_read$datapath)
# head(a,n=15)
# })
}
shinyApp(ui, server)