I'm trying to create a shiny app that uses information that's available externally in a google spreadsheet, which I'm downloading to a temporary .csv file. The app works correctly on my local machine, but when I try to push it to shinyapps.io the app fails. I've attempted to recreate the error below using a simply example. The shiny app can be found here: https://n8sty.shinyapps.io/test/. I've copied the server.R and ui.R files that work locally below.
I believe the issue is that the server doesn't handle downloading the external google sheet file in the same manner as my local machine. Does anyone know how to use google docs in a shiny app?
ui.r
require(shiny)
shinyUI(fluidPage(
mainPanel(
tableOutput("table")
)
))
server.r
require(shiny)
td <- tempdir()
tf <- tempfile(pattern = 'test', tmpdir = td, fileext = '.csv')
url <- 'https://docs.google.com/spreadsheets/d/1c1ZI0P0ydunm-wc1eb3-jYbWfwMZQc4eAyWlHJut2wY/export?usp=sharing&format=csv'
download.file(url, tf, method = 'auto', quiet = TRUE)
df <- read.csv(tf)
shinyServer(function(input, output) {
output$table <- renderTable({
df
})
})
Thanks