Open AmandaBirmingham opened 6 years ago
Nevermind, just tested and it is still an issue.
@adswafford TL;DR: Implementing this would either slow down performance considerably or require a major rewrite, and thus probably isn't worth it. Can I interest you in a "DO NOT DELETE" message of some kind on the hidden sheets instead? :)
Details: I've done some looking into this. Excel doesn't have a facility to JUST password protect hiding/showing sheet(s); what it has is a "Protect Workbook" option with a "Protect Structure" setting. When this is turned on, NO sheet in the workbook can be moved, deleted, hidden, or unhidden, and no new sheets can be added:
So this is sort of the nuclear option.
It does not appear that workbook protection (as opposed to worksheet protection, which is already in use in QIIMP) is implemented in the xlsxwriter
library that QIIMP uses to create new excel spreadsheets. It IS implemented in openpyxl
(which QIIMP uses to read in existing workbooks); see https://openpyxl.readthedocs.io/en/stable/protection.html :
However, loading large workbooks (like those created by QIIMP) into openpyxl
is slow--on the order of seconds. This means that writing a workbook with existing code (using xlsxwriter
) and then opening it with openpxyl
to protect its structure is a non-starter from a performance perspective. It might be theoretically possible to refactor QIIMP to do all its excel creation with openpyxl
instead of with xlsxwriter
but (a) I don't know if openpyxl
supports all the functionality we need, and (b) it would probably be a lot of coding work.
Based on what you described, the DND option sounds reasonable. While I am okay with preventing users from creating or deleting new sheets inside the workbook (the nuclear option), it sounds like it would still be too much effort at this time to refactor it, especially since doing so would potentially lead to new and no-doubt interesting bugs..
@AmandaBirmingham I think this issue is no longer a problem