Can't Publish Content - The content type 'Content' is not currently supported for publishing. - R Shiny Error

Hi everyone,

I m trying to run a file processing script, by building out a file downloader widget Shiny app. This is where I upload a customized xlsx file, and I run the code after clicking downloadbutton to get the datasets I need.

I have successfully run this locally, but when I go to publish this, I get this error

R Shiny Publish Error

Idk what is the root cause of this error, and have tried other things as well, but with no luck. Can anyone tell me why am I not able to publish this?

library(shiny)
library(openxlsx)
library(readxl)
library(writexl)
library(dplyr)
library(magrittr)
library(lubridate)


ui <- fluidPage(
  
  titlePanel("EG File Management"),
  
  sidebarLayout(
    sidebarPanel(
      fileInput('file1', 'Upload file',
                accept=c('text/csv',
                         'text/comma-separated-values,text/plain',
                         '.csv','.xlsx'))
      
      
    ),
    
    mainPanel(
      downloadButton('downloadRL',"RL"),
      downloadButton('downloadFortnite',"FN"),
      tableOutput("outdata1")
      
      
    )
  )    
)      


server <- function(input, output) {
  
  options(shiny.maxRequestSize=90*1024^2)  
  
  
  output$outdata1 <- renderTable({
    
    
    if(is.null(input$file1)) {return()}
    
    else{
      
      input$file1
      
    }
    
  })  
  
  
  
  
  output$downloadRL<-downloadHandler(
    
    filename = function(fname){paste0("RL Dl'd Report",".xlsx")},
    content = function(fname){
      
    
    dspec <- input$file1
    
    EC_Raw_Delivery <-read_excel(dspec$datapath, sheet = 4)%>%select(1:9)
    EC_Raw_Conversions <-read_excel(dspec$datapath, sheet = 2)%>%select(1:9)
    EC_Linemap <-read_excel(dspec$datapath, sheet = 5)%>%select(1:2)
    EC_RLmap <-read_excel(dspec$datapath, sheet = 6)%>%select(1:2)
    
    
    
    Delivery_semis <- merge(EC_Raw_Delivery,EC_RLmap,all.x = FALSE)
    
    

    Delivery_final_RL <- Delivery_semis %>% select(Date,`Campaign Name`,'Line Item',`Line Item Name / Target`,`Creative Name`,Impressions,Clicks,`CTR%`,`Budget Delivered`,`RL`) %>% filter(!is.na(Delivery_semis[10]))
    
    Delivery_final_RL <- select(Delivery_final_RL,1:9) #Remove RL column
    
    
    
    #Adding columns to Delivery_final_RL
    
    Delivery_final_RL[,"Click Based Conversions"] <- " "
    Delivery_final_RL[,"View Based Conversions"] <- " "
    Delivery_final_RL[,"ProductDisplayName"] <- " "
    Delivery_final_RL[,"Revenue"] <- " "
    
    
    EC_Raw_Conversions_RL <- EC_Raw_Conversions%>%select(everything()) %>% filter(grepl("RocketLeague",EC_Raw_Conversions$BannerName))
    
    
    Conversions_map_RL <- merge(EC_Raw_Conversions_RL,EC_Linemap,by.x = "LineId",all.x = TRUE)
    
    
    
    Conversions_map_RL[,"Impressions"]  <- " "
    Conversions_map_RL[,"Clicks"] <- " "
    Conversions_map_RL[,"CTR%"] <- " "
    Conversions_map_RL[,"Budget Delivered"] <- " "
    
    
    
    Conversions_RL <- Conversions_map_RL %>% select(PurchaseTime,`Campaign Name`,LineId,Match,BannerName,Impressions,Clicks,`CTR%`,`Budget Delivered`,`Click Based Conversions`,`View Based Conversions`,ProductDisplayName,Revenue)
    
    
    names(Delivery_final_RL)[1] <- "PurchaseTime" 
    names(Delivery_final_RL)[3] <- "LineId" 
    names(Delivery_final_RL)[4] <- "Line Name" 
    names(Delivery_final_RL)[5] <- "BannerName" 
    names(Delivery_final_RL)[12] <- "ProductDisplayName"
    
    
    names(Conversions_RL)[4] <- "Line Name"  #turn to Line Name from Match, after lookup
    
    
    Conversions_RL$Impressions <- as.numeric(Conversions_RL$Impressions)
    Conversions_RL$Clicks<- as.numeric(Conversions_RL$Clicks)
    Conversions_RL```
CTR%`<- as.numeric(Conversions_RL```
CTR%`)
    Conversions_RL```
Budget Delivered`<- as.numeric(Conversions_RL```
Budget Delivered`)
    
    Delivery_final_RL```
Click Based Conversions` <- as.numeric(Delivery_final_RL```
Click Based Conversions`)
    Delivery_final_RL```
View Based Conversions` <- as.numeric(Delivery_final_RL```
View Based Conversions`)
    
    
    
    Delivery_final_RL```
Revenue` <- as.numeric(Delivery_final_RL```
Revenue`)
    
    Delivery_final_RL$PurchaseTime <- as.Date(Delivery_final_RL$PurchaseTime)
    
    Conversions_RL$PurchaseTime <- as.Date(Conversions_RL$PurchaseTime)
    
    combinedfinal_RL<- bind_rows(Conversions_RL,Delivery_final_RL)
    
    #Acquisition and Retention assignment
    combinedfinal_RL<- mutate(combinedfinal_RL, Targeting = ifelse(regexpr("not|Not",combinedfinal_RL```
Line Name`) > 0,"Acquisition","Retention"))
    
    #Extract Region from Line Item Name
    combinedfinal_RL<- mutate(combinedfinal_RL, Region = substr(combinedfinal_RL```
Line Name`,1,2))
    
    #Extract WeekDay 
    combinedfinal_RL<- mutate(combinedfinal_RL, Week = combinedfinal_RL$PurchaseTime-wday(combinedfinal_RL$PurchaseTime,label = FALSE,week_start = 1)+1)
    
    #Extract Week of Day
    combinedfinal_RL<- mutate(combinedfinal_RL, `Day of Week` = wday(combinedfinal_RL$PurchaseTime,label = TRUE,abbr = FALSE))
    
    #Home vs Store
    combinedfinal_RL<- mutate(combinedfinal_RL, PlacementLocation = ifelse(regexpr("416x216",combinedfinal_RL```
BannerName`) > 0,"Home","Store"))
    
    #Roadblock vs Rotational
    combinedfinal_RL<- mutate(combinedfinal_RL, RBvsRot = ifelse(regexpr("Roadblock",combinedfinal_RL```
Line Name`) > 0,"Roadblock","Rotational"))
    
    #Sweep vs Non Sweep
    
    combinedfinal_RL<- mutate(combinedfinal_RL, `Sweeps/NonSweeps` = ifelse(regexpr("Sweeps",combinedfinal_RL```
Line Name`) > 0,"Sweeps","Non Sweeps"))
    
    
    combinedfinal_RL<-combinedfinal_RL%>%arrange(combinedfinal_RL$PurchaseTime)
    Conversions_RL <- Conversions_RL%>%arrange(Conversions_RL$PurchaseTime)
    Delivery_final_RL <- Delivery_final_RL%>%arrange(Delivery_final_RL$PurchaseTime)
    
    
    sheets_RL<- list("Delivery" = Delivery_final_RL, "Conversions" = Conversions_RL, "Combined" = combinedfinal_RL)
    
    write_xlsx(sheets_RL,fname)
    
    
  }
  
  
  ) 

  
  output$downloadFortnite<-downloadHandler(
    
    filename = function(fname){paste0("FN Dl'd Report",".xlsx")},
    content = function(fname){
      
      dspec <- input$file1
  
  EC_Raw_Delivery <-read_excel(dspec$datapath, sheet = 4)%>%select(1:9)
  EC_Raw_Conversions <-read_excel(dspec$datapath, sheet = 2)%>%select(1:9)
  EC_Linemap <-read_excel(dspec$datapath, sheet = 5)%>%select(1:2)
  EC_RLmap <-read_excel(dspec$datapath, sheet = 6)%>%select(1:2)
  
  #Differentiate between RL and Fortnite
  Delivery_semis <- merge(EC_Raw_Delivery,EC_RLmap, by.x = "Line Item", all.x  = TRUE)
  
  #Delivery Report for Fortnite
  Delivery_final_Fortnite <- Delivery_semis %>% select(Date,`Campaign Name`,'Line Item',`Line Item Name / Target`,`Creative Name`,'Impressions','Clicks',`CTR%`,`Budget Delivered`,`RL`) %>% filter(is.na(`RL`))
  
  Delivery_final_Fortnite <- Delivery_final_Fortnite%>%select(1:9) #Remove RL column

  
  
  #Converting them to blanks
  Delivery_final_Fortnite```
Click Based Conversions` <- " "
  Delivery_final_Fortnite```
View Based Conversions` <- " "
  Delivery_final_Fortnite```
ProductDisplayName` <- " "
  Delivery_final_Fortnite```
Revenue` <- " "
  
  
  
  
  
  
  #Conversions Report Processing
  
  names(EC_RLmap)[1] <- "LineId"                                                                          #changing the name in mapping to match Column Name in Conversions report
  EC_Raw_Conversions_semis <- merge(EC_Raw_Conversions,EC_RLmap,by.x = "LineId",all.x = TRUE)              #map by lineIDs
  EC_Raw_Conversions_Fortnite <- EC_Raw_Conversions_semis%>%select(everything()) %>% filter(is.na(RL))      #filtering out those which are not RL rows
  EC_Raw_Conversions_Fortnite <- subset(EC_Raw_Conversions_Fortnite, select = -c(`RL`))                          #deleting RL column, as it's only a differentiator
  
  
  
  
  Conversions_map_Fortnite <- merge(EC_Raw_Conversions_Fortnite,EC_Linemap,by.x = "LineId",all.x = TRUE)
  
  
  
  #Removing data for Fortnite
  Conversions_map_Fortnite$Impressions <- " "
  Conversions_map_Fortnite$Clicks <- " "
  Conversions_map_Fortnite```
CTR%` <- " "
  Conversions_map_Fortnite```
Budget Delivered` <- " "
  
  Conversions_Fortnite <- Conversions_map_Fortnite %>% select(PurchaseTime,`Campaign Name`,LineId,Match,BannerName,Impressions,Clicks,`CTR%`,`Budget Delivered`,`Click Based Conversions`,`View Based Conversions`,ProductDisplayName,Revenue)
  
  
  
  
  #Renaming columns to append data
  
  #Delivery Report Fornite
  names(Delivery_final_Fortnite)[1] <- "PurchaseTime"
  names(Delivery_final_Fortnite)[3] <- "LineId" 
  names(Delivery_final_Fortnite)[4] <- "Line Name" 
  names(Delivery_final_Fortnite)[5] <- "BannerName" 
  names(Delivery_final_Fortnite)[12] <- "ProductDisplayName"
  
  
  
  
  #Conversions Report renaming
  
  names(Conversions_Fortnite)[4] <- "Line Name"  #turn to Line Name from Match, after lookup 
  
  Conversions_Fortnite$Impressions <- as.numeric(Conversions_Fortnite$Impressions)
  Conversions_Fortnite$Clicks<- as.numeric(Conversions_Fortnite$Clicks)
  Conversions_Fortnite```
CTR%`<- as.numeric(Conversions_Fortnite```
CTR%`)
  Conversions_Fortnite```
Budget Delivered`<- as.numeric(Conversions_Fortnite```
Budget Delivered`)
  
  
  
  Delivery_final_Fortnite```
Click Based Conversions` <- as.numeric(Delivery_final_Fortnite```
Click Based Conversions`)
  Delivery_final_Fortnite```
View Based Conversions` <- as.numeric(Delivery_final_Fortnite```
View Based Conversions`)
  
  Delivery_final_Fortnite```
Revenue` <- as.numeric(Delivery_final_Fortnite```
Revenue`)
  
  
  
  
  #fixing dates
  Delivery_final_Fortnite$PurchaseTime <- as.Date(Delivery_final_Fortnite$PurchaseTime)
  
  
  Conversions_Fortnite$PurchaseTime <- as.Date(Conversions_Fortnite$PurchaseTime)
  
  combinedfinal_Fortnite<- bind_rows(Conversions_Fortnite,Delivery_final_Fortnite)    
  
  #Acquisition and Retention assignment
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, A_R = ifelse(regexpr("not DL'ed|Not DL'ed",combinedfinal_Fortnite```
Line Name`) > 0,"Acquisition","Retention"))
  
  #Extract Region from Line Item Name
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, Region = substr(combinedfinal_Fortnite```
Line Name`,1,2))
  
  #Extract Weekday 
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, Week = combinedfinal_Fortnite$PurchaseTime-wday(combinedfinal_Fortnite$PurchaseTime,label = FALSE,week_start = 1)+1)
  
  
  #Extract Week of Day
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, `Day of Week` = wday(combinedfinal_Fortnite$PurchaseTime,label = TRUE,abbr = FALSE))
  
  
  #Home vs Store
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, PlacementLocation = ifelse(regexpr("416x216",combinedfinal_Fortnite```
BannerName`) > 0,"Home","Store"))
  
  
  #Roadblock vs Rotational
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, RBvsRot = ifelse(regexpr("Roadblock",combinedfinal_Fortnite```
Line Name`) > 0,"Roadblock","Rotational"))
  
  
  #Sweep vs Non Sweep
  
  combinedfinal_Fortnite<- mutate(combinedfinal_Fortnite, `Sweeps/NonSweeps` = ifelse(regexpr("Sweeps",combinedfinal_Fortnite```
BannerName`) > 0,"Sweeps","Non Sweeps"))
  
  #Arranging in Ascending order by Date
  combinedfinal_Fortnite<-combinedfinal_Fortnite%>%arrange(combinedfinal_Fortnite$PurchaseTime)
  Delivery_final_Fortnite<-Delivery_final_Fortnite%>%arrange(Delivery_final_Fortnite$PurchaseTime)
  Conversions_Fortnite<-Conversions_Fortnite%>%arrange(Conversions_Fortnite$PurchaseTime)
  
  #compiling
  
  sheets_Fortnite<- list("Delivery" = Delivery_final_Fortnite, "Conversions" = Conversions_Fortnite, "Combined" = combinedfinal_Fortnite)
  
  write_xlsx(sheets_Fortnite,fname)
  
  
    }  
  
)
  
  
}
runApp(shinyApp(ui=ui, server=server),launch.browser = TRUE)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.