【发布时间】:2020-02-16 22:09:13
【问题描述】:
我正在尝试下载我闪亮的应用程序中已经存在的 excel 文件。
我在server.R中尝试了以下代码
output$downloadbutton <- downloadHandler(
filename <- function() {
paste("result_balance", "xlsx", sep=".")
},
content <- function(file) {
#temp <- file.path(tempdir(), "report.Rmd")
file.copy(file.path(getwd(),'www','result.xlsx'), file,overwrite = TRUE)
},
contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)
但是当用户点击下载按钮时,它会弹出一个下载,如下所示:
它会下载一个包含 xml/html 文件的文件夹。 奇怪的是,提议的名称是 downloadbutton,就像我的 id shiny 元素一样。
我已经知道这个R Shiny: Download existing file。
Ubuntu 18.04 上的 R 版本 3.6.2
【问题讨论】: