title: Connection to Google Spreadsheets not opening in Shiny Server
body: <p>I have been trying to use Shiny to read and analyze new format Google spreadsheets using the functions <a href="http://blog.revolutionanalytics.com/2014/06/reading-data-from-the-new-version-of-google-spreadsheets.html" rel="nofollow">here</a>.</p>
  
  <p>This works fine locally but not when I deploy to shinyapps.io.</p>
  
  <p>One issue was the known issue of false positives on the test for absolute paths but that is solved by forcing deployment in the console.  However once uploaded  I'm getting the javascript dump alert with this error</p>
  
  <pre><code>label, label&lt;-Error in file(con, "r") : cannot open the connection
  </code></pre>
  
  <p>I've looked around and I can see that people get the javascript error dump for a lot of reasons, and the closest I  saw was where someone needed to use RCurl, but that didn't help me. I also know that I have https in the url so that is not the issue. The spreadsheet I am reading is definitely published to the web; anything obvious like that would have made it not work locally. </p>
  
  <p>Update: I'll copy the code for the functions here.</p>
  
  <pre><code>library(XML)
  
  cleanGoogleTable &lt;- function(dat, table=1, skip=0,
  
  ncols=NA, nrows=-1, header=TRUE, dropFirstCol=NA){  
  
  if(!is.data.frame(dat)) {
  
      dat &lt;- dat[[table]]   }   if(is.na(dropFirstCol)) {
      firstCol &lt;- na.omit(dat[[1]])
      if(all(firstCol == ".") || all(firstCol== as.character(seq_along(firstCol)))) {
  
        dat &lt;- dat[, -1]
      }   } else if(dropFirstCol) {
      dat &lt;- dat[, -1]   }   if(skip &gt; 0){
      dat &lt;- dat[-seq_len(skip), ]   }   if(nrow(dat) == 1) return(dat)   if(nrow(dat) &gt;= 2){
      if(all(is.na(dat[2, ]))) dat &lt;- dat[-2, ]   }   if(header &amp;&amp; nrow(dat) &gt; 1){
      header &lt;- as.character(dat[1, ])
      names(dat) &lt;- header
      dat &lt;- dat[-1, ]   }   # Keep only desired columns   if(!is.na(ncols)){
  
      ncols &lt;- min(ncols, ncol(dat))
      dat &lt;- dat[, seq_len(ncols)]   }   # Keep only desired rows   if(nrows &gt; 0){
      nrows &lt;- min(nrows, nrow(dat))
      dat &lt;- dat[seq_len(nrows), ]   }   # Rename rows   rownames(dat) &lt;- seq_len(nrow(dat))   dat }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>readGoogleSheet &lt;- function(url, na.string="", header=TRUE){
    stopifnot(require(XML))
    # Suppress warnings because Google docs seems to have incomplete final line
    suppressWarnings({
      doc &lt;- paste(readLines(url), collapse=" ")
    })
    if(nchar(doc) == 0) stop("No content found")
    htmlTable &lt;- gsub("^.*?(&lt;table.*&lt;/table).*$", "\\1&gt;", doc)
    ret &lt;- readHTMLTable(htmlTable, header=header, stringsAsFactors=FALSE, as.data.frame=TRUE)
    lapply(ret, function(x){ x[ x == na.string] &lt;- NA; x})
  }
  </code></pre>