Title: | A 'shiny' Module for Reading Excel Sheets |
---|---|
Description: | This is a shiny module that presents a file picker user interface to get an Excel file name, and reads the Excel sheets using 'readxl' package and returns the resulting sheet(s) as a vector and data in dataframe(s). |
Authors: | Yadu Balehosur <[email protected]> |
Maintainer: | Yadu Balehosur <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4 |
Built: | 2025-02-21 03:45:02 UTC |
Source: | https://github.com/byadu/modgetxl |
Convert excel sheets to dataframes, display in DT, and return the dataframes
getxl(input, output, session)
getxl(input, output, session)
input |
is shiny input variable |
output |
is shiny output variable |
session |
is shiny session variable |
This is a shiny module that presents a file picker UI to get an Excel file name, and reads the Excel sheets using readxl package and returns the resulting sheet(s) as a vector and data in dataframe(s).
See xlex for examples
UI to get a excel file name
getxlUI(id)
getxlUI(id)
id |
is the caller's id |
Server function to display excel data as DT
xldisp(input, output, session, xlfile, skiprows)
xldisp(input, output, session, xlfile, skiprows)
input |
is shiny input variable |
output |
is shiny output variable |
session |
is shiny session variable |
xlfile |
is the name of the xl file being got |
skiprows |
is number of rows to skip in the excel file |
UI to display excel sheets read as individual data tables
xldispUI(id, xlfile)
xldispUI(id, xlfile)
id |
is caller's id |
xlfile |
is the name of the xl file being got |
use shiny module getxl/UI for interactive input of Excel files
library(shiny) library(modgetxl) app<- shinyApp( ui= uiOutput('xltest'), server= function(input, output) { sink(file=stderr()) options(shiny.maxRequestSize=1*1024^2) # 1MB output$xltest<- renderUI({ getxlUI('server') }) xl<- callModule(getxl, 'server') # excel sheets info and data are available once user uploads excel file in UI # returned xl has reactiveValues of two variables as below observeEvent(xl$sheets,{ print(xl$sheets) print(head(xl$sheetdata[[1]])) }) } ) ## Not run: runApp(app) ## End(Not run)
library(shiny) library(modgetxl) app<- shinyApp( ui= uiOutput('xltest'), server= function(input, output) { sink(file=stderr()) options(shiny.maxRequestSize=1*1024^2) # 1MB output$xltest<- renderUI({ getxlUI('server') }) xl<- callModule(getxl, 'server') # excel sheets info and data are available once user uploads excel file in UI # returned xl has reactiveValues of two variables as below observeEvent(xl$sheets,{ print(xl$sheets) print(head(xl$sheetdata[[1]])) }) } ) ## Not run: runApp(app) ## End(Not run)