Error in getTableData: could not find function "getTableData"
I'm trying to replicate the code found in the "Getting table data in Shiny" section, but it seems that the getTableData function is not contained in the package. I have tried both the CRAN and github versions.
R version 4.1.2
@awdursun Can you please add the code that you tried so that I can replicate the issue?
Sorry, I should have been more thorough. I'm using the exact code in the "Getting table data in Shiny" section at https://swechhya.github.io/excelR/
library(excelR)
library(shiny)
shinyApp(
ui = fluidPage(actionButton('get', 'Get table data'),
tableOutput("fetchedData"),
excelOutput("table", height = 175)),
server = function(input, output, session) {
output$table <- renderExcel(excelTable(data = head(iris)))
# Get the table data
observeEvent(input$get,{
getTableData("table")
})
# Print the table
observeEvent(input$table,{
output$fetchedData <- renderTable(excel_to_R(input$table))
})
}
)
The app launches without issue but after hitting the action button, 'Error in getTableData: could not find function "getTableData"' displays in the console. This is because my installation of excelR does not contain the getTableData function.
@awdursun Can you please try with the latest development version and let me know if it still is causing an issue for you?
SOLVED
This issue resolved itself for me.
I restarted R-Studio and ran `renv::snapshot()`.
After that, the `getDataTable` function worked.
Hello,
I am having the same problem with the getTableData function. Has this been resolved.
My error is:
Warning: Error in getTableData: could not find function "getTableData"
I am running:
- RStudio 2022.12.0+353 "Elsbeth Geranium" Release (7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for macOS, Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36
- R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
- shiny version 1.7.2
- excelR version 0.4.0 (downloaded from GitHub 2022-12-24
My code is:
library(shiny)
library(shinyWidgets)
library(excelR)
ui <- fluidPage(actionBttn('get', 'Get table data'),
excelOutput("baseTable"),
hr(),
tableOutput("fetchedData"),
hr()
)
server <- function(input, output) {
output$baseTable <- renderExcel({
cntSections = 8
data <- data.frame(
section = seq(1, cntSections),
position = rep("hoods", cntSections),
distance = rep(1, cntSections),
grade = rep(0, cntSections),
headwind = rep(0, cntSections),
temp = rep(15, cntSections),
elev = rep(1800, cntSections),
power = rep(180, cntSections),
velocity = rep(0, cntSections)
)
excelTable(data = data)
})
observeEvent(input$get, {
getTableData("baseTable")
})
observeEvent(input$baseTable, {
output$fetchedData <- renderTable({
excel_to_R(input$baseTable)
})
})
}
shinyApp(ui, server)
Can you reproduce the error? If so, do you have a fix?
Closing this issue as it’s already solved.