Unable to write and download multiple csv files in Shiny app

Hello. First post in the forum, and new to Shiny. I am trying to to write multiple csv files of processed data, which was processed in the Shiny app, and zip them up to download. I have been struggling for about two weeks! I have tried with and without downloadHandler. I am only able to write and download one file at a time. Could anyone help?
Note: The original uploaded data is in list s, and there are two types of data you can download (stored in datasetInput).
Thank you!

 output$downloadZip <- downloadHandler(
    filename = function(){
      paste("maldiprocresults",".zip")
    },
    content = function(con){
    tmpdir <- tempdir()
    setwd(tempdir())
    filestosave=c()
      for (i in 1:length(s)){
  	 x<-as.matrix(datasetInput()[[i]])
  	 f<-(paste("maldiprocres", names(s)[[i]], sep="_" ))
  	 filestosave=c(filestosave,write.csv(x,f))  	
 } 		
  	zip(zipfile=con, files=filestosave)
 	  },
     contentType = "application/zip"
  )

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.