6

I have a shiny application that takes input via selectizeInput and enters the data into a fixed size dataframe that is displayed and updated as users enter data. As the user enters data, the dataframe is filled out. Every time the user enters new data, I use the googlesheets package to upload the altered dataframe to a google sheet. This upload process takes 2 or 3 seconds, and the shiny app will wait for it to finish before updating the UI and displaying the dataframe. The process of saving to google sheets should be a background task and occur without the shiny app waiting for it to finish. Is there a way to accomplish this?

Here's what it looks like...

observeEvent(input$timer_start,
    {       
      tmp <- row_col(val$cell, input$team_num)      
      val$df[tmp$row, tmp$col] <- input$name
      tmp_df <<- val$df
      edit_cells(gs, ws=1, tmp_df, header=TRUE)        
    })
cory
  • 6,529
  • 3
  • 21
  • 41
  • By in the background, do you mean in parallel to another process? Some soft research shows that shiny supports this, but generally setting up R for parallel takes some wrangling. Another option would be to upload after the data sheet is displayed. It is still sequential, your user would just not notice the delay. – Chris May 13 '15 at 20:22
  • In the background, as in... don't hold up anything else while the upload to google sheets is happening. The UI grays out the table as the upload happens. I'm trying to avoid this. – cory May 13 '15 at 20:28
  • You may use the [promises](https://rstudio.github.io/promises/articles/shiny.html) package from RStudio, – Simon Müller May 15 '19 at 21:01

0 Answers0