awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 79 forks source link

Add range protection #412

Closed DavisVaughan closed 6 years ago

DavisVaughan commented 6 years ago

This PR implements the protectRange() function. It should be incorporated alongside #411. It protects an Excel range so that when a worksheet is protected with protectWorksheet(), specific ranges are still editable with or without a password specific to that range.

I see this PR being useful when creating data entry templates with R. A data scientist could create a boxed off "holy grail" sheet / range where an analyst can enter data and then pass it back to the data scientist for further munging. The protection prevents the analyst from entering data in cells that could cause the data scientist issues.

CC @kainhofer

codecov[bot] commented 6 years ago

Codecov Report

Merging #412 into master will increase coverage by 0.35%. The diff coverage is 80.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #412      +/-   ##
==========================================
+ Coverage   60.23%   60.59%   +0.35%     
==========================================
  Files          30       30              
  Lines        7031     7156     +125     
==========================================
+ Hits         4235     4336     +101     
- Misses       2796     2820      +24
Impacted Files Coverage Δ
R/helperFunctions.R 75.56% <100%> (+0.62%) :arrow_up:
R/worksheet_class.R 72.93% <50%> (-0.72%) :arrow_down:
src/load_workbook.cpp 89.85% <66.66%> (-0.3%) :arrow_down:
R/loadWorkbook.R 69.56% <75%> (-0.02%) :arrow_down:
R/wrappers.R 44.34% <80.89%> (+2.7%) :arrow_up:
R/WorkbookClass.R 55.56% <84.61%> (+0.3%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 025605f...c69f202. Read the comment docs.

DavisVaughan commented 6 years ago

Need to refactor on top of #413 rather than #411. Use the hashPassword() helper function. Waiting for that PR to be accepted before doing the refactoring in case anything else changes.

olangfor commented 6 years ago

Hi,

Sorry to bother you. I noticed there is some work being done (or completed) on protecting the excel sheet. I'm specifically interested in the protectRange functionality. Is there a dev version I use? or better still, when is the release version expected?

Thank you for your great work! Sorry if this information is located elsewhere.

Kind regards,

OIiver

DavisVaughan commented 6 years ago

@olangfor I just closed and reopened this in #421 with a proper implementation now that #413 has been merged. Installing that PR should work if you need it immediately.