我有一个数据帧已传递到下面的列表
P.attached_all<-list("Airtime and Data" = P_Airtime_Data,
"Cable TV" = P_cable,
"Electricity" = P_Electricity,
"Betting" = P_betting,
"Pin" = P_Pin)
我想要做的是用密码保护整个文件,当用户单击并下载然后打开文件时,它会首先提示他们输入密码。
我已经尝试过下面这个方法 图书馆(XLConnect)
# load but do not attach the write.xlsx() function from the xlsx package ----
xlsx::write.xlsx(x = mtcars, file = "mtcars.xlsx", password = "1234_fghj")
去买网上分享的例子,我想出了自己的
xlsx::write.xlsx(x = attached_all, file = "mtcars.xlsx", password = "1234_fghj")
我在下面收到此错误。
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 59977, 0
是否有任何解决方案或任何软件包可以更好地完成这项工作,我真的需要帮助 谢谢
wb_protect()
library(openxlsx2)
wb <- wb_workbook()
wb$add_worksheet("S1")
wb <- wb_protect(
wb,
protect = TRUE,
password = "Password",
lock_structure = TRUE,
type = 2L,
file_sharing = TRUE,
username = "Test",
read_only_recommended = TRUE
)
如果您想要文件级加密,请查看msoc。