Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protectWorkbook does not work #525

Open
realbeast91 opened this issue Dec 1, 2020 · 1 comment
Open

protectWorkbook does not work #525

realbeast91 opened this issue Dec 1, 2020 · 1 comment

Comments

@realbeast91
Copy link

realbeast91 commented Dec 1, 2020

Expected Behavior

protectWorkbook() is supposed to add password protection when trying to open Excel

Actual Behavior

Code runs successfully but it is not password protected, and can open the file directly

Steps to Reproduce the Problem

df = data.frame(Year = c(2018,2019,2020,2018,2019,2020,2018,2019,2020),
                Country = c("Germany","Germany","Germany", "Japan", "Japan", "Japan",  "Thailand", "Thailand", "Thailand"), 
                Count = c(17, 15, 60, 23, 25, 60, 50, 18, 31))

wb = createWorkbook()
addWorksheet(wb, "Master")
writeDataTable(wb, "Master", df, tableStyle = "TableStyleLight9")
yellow_style = createStyle(fgFill = "#FFFF00")
y = which(colnames(df) == "Count")
x = which(abs(df$Count) > 32)
addStyle(wb, sheet = "Master", style = yellow_style, rows = x+1, col = y)
protectWorkbook(wb, protect = TRUE, password = "Password", lockStructure = TRUE)
saveWorkbook(wb, "Master.xlsx", overwrite = TRUE)

sessionInfo()

  • Version of R: 3.6.1
    -Version of openxlsx: 4.1.4
@JMPivette
Copy link

Could you please create this bug at ycphs/openxlsx?

This is the active fork of the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants