0

In my Shiny app I am reading an Excel file with read_excel. If during the upload a warning appears I need to capture all warning in a list so that I can process the list any further. However, the current approach with tryCatch does not work.

Here is my code (in the Shiny server module):

data <- reactive({(
    req(input$file1)
    inFile <- input$file1
    browser()
    data <- tryCatch(read_excel(inFile$datapath, 1), 
                 warning <- function(war){
                   message(war)
                 })    
})

Thank you very much!

Andi Maier
  • 914
  • 3
  • 9
  • 28
  • It would be great if you provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and an example excel file that produces a warning. – starja Aug 04 '20 at 21:18

1 Answers1

0

I did the following: created a new object warn and stored the warnings in the object and I am working with this object then

warn <- tryCatch(read_excel(inFile$datapath, 1), 
                 warning = function(war){
                  war
                 })
Andi Maier
  • 914
  • 3
  • 9
  • 28