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
.
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.)
password
argument towrite.xlsx
. However, you said that you got anunused argument
error when you tried this. You might just need to update the package. The latest version ofxlsx
is 0.6.1, released on June 7, 2018, in whichwrite.xlsx
has apassword
argument. I happen to havexlsx
version 0.5.7 installed at the moment and there's nopassword
argument in that version. – Androgen