Hi
how can I call excel file cell value ex A5 cell value as numeric input in the shiny R studio
once the user input numeric number in shiny cell >> it should automatically be calculated in excel and print the result in shiny R studio as following?
process:
Excel sheet cells A5 +A6 = A7
shiny R studio insert A5 A6 input values in shiny
print the values in Excel sheet
calculate the result in cell A7
print the result back in Shiny R Studio
how can I call A5 A6 A7 from Excel sheet as input values in shiny R studio
now I can locate a specific excel sheet ex: A5 using tidyxl library , but how can I use excel cell A5 value as numeric input in shiny app?
thanks in advance
library(tidyxl)
library(dplyr)
library(shiny)
ui <- fluidPage(
numericInput("myInput", "Value", value = 0)
)
server <- function(input, output, session) {
shinyApp(ui, server)
#This is just needed to access the xlsx file that comes with package
testFile <- system.file("extdata/examples.xlsx", package = "tidyxl")
#Use the path to your file here instead of testFile
myXlsxFile = xlsx_cells(testFile, sheets = 1)
#Pull whatever value you need
newValue = myXlsxFile %>% filter(address == 'A5') %>% pull(numeric)
#Update the value
updateNumericInput(session, "myInput", value = newValue)
}
shinyApp(ui, server)
thanks alot PJ for the illustrated example,
I have another question
is it possible to import the user numeric input values into the excel sheet again and run the equation embedded in the cell then pull the updated result again to the Shiny app for example
in excel A3 cell contains an equation " A1 cell + A2 cell "
in shinyapp can I use the A1 and A2 values imported by the user into the excel sheet and present the A3 value result in the shiny app output automatically?