如何使用write.xlsx对在R中创建的Excel文件进​​行密码保护? [英] How do I password-protect an Excel file created in R with write.xlsx?

查看:134
本文介绍了如何使用write.xlsx对在R中创建的Excel文件进​​行密码保护?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R中的数据分析中,有时会使用write.xlsx将数据输出到Excel文件.这些文件需要使用密码保护,目前,我正在使用Excel打开不受保护的文件,然后使用File - Protect Workbook - Encrypt with Password添加密码.

In my data analysis in R I sometimes output data to Excel files using write.xlsx. These files need to be password-protected, and currently I am doing this by opening the unprotected file using Excel, and then adding a password using File - Protect Workbook - Encrypt with Password.

是否可以直接在R中执行此操作,从而不必打开Excel文件并手动添加密码? (我想用密码保护整个工作簿,而不仅仅是一张纸.)

Is there a way to do this directly in R so that I don't have to open the Excel file and manually add the password? (I want to password-protect the whole workbook, not just a single sheet.)

推荐答案

在xlsx手册中,您可以在password参数中设置密码:

From the xlsx manual, you can set the password in the password argument:

write.xlsx(x, file, sheetName="Sheet1", col.names=TRUE, row.names=TRUE, append=FALSE, showNA=TRUE, password=NULL)

这篇关于如何使用write.xlsx对在R中创建的Excel文件进​​行密码保护?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆