Commit 1e631c33 authored by Aqeel Padaria's avatar Aqeel Padaria

allow for upload of excels

parent d7b4b6ad
......@@ -185,9 +185,9 @@ server = shinyServer(
output$fileUpload <- renderUI({
fileInput("file1", "Upload TSFO File as .rds",
fileInput("file1", "Upload TSFO File",
multiple = FALSE,
accept = c(".rds", ".RDS"))
accept = c(".rds", ".RDS", ".xlsx"))
})
validUpload <- reactive({
......@@ -218,6 +218,22 @@ server = shinyServer(
dsName <- gsub(".rds", "", input$file1$name)
assign(dsName, file4, envir=globalenv())
}
if(grepl(".xlsx", input$file1$name))
{
file4main <- read.xlsx(input$file1$datapath, sheet = "main", colNames = TRUE, check.names = FALSE)
file4other <- list()
file4sheets <- getSheetNames(input$file1$datapath)
file4sheets <- setdiff(file4sheets, "main")
for(sheetName in file4sheets)
{
file4other[[sheetName]] <- read.xlsx(input$file1$datapath, sheet = sheetName, colNames = TRUE, check.names = FALSE)
}
file4 <- list(file4main, file4other)
names(file4) <- c("main", "data")
dsName <- gsub(".xlsx", "", input$file1$name)
assign(dsName, file4, envir=globalenv())
}
}
files2 <- ls(envir=globalenv())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment