Created
February 10, 2017 18:51
-
-
Save truekonrads/b5c233b1bcde5f01bfe4747c83dd51c7 to your computer and use it in GitHub Desktop.
Bulk remove sheet protection from xlsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C=`pwd`;for i in *.xlsx; do cd $C; b=$(basename "$i" .xlsx); rm -rf "$b"; mkdir "$b"; unzip -d "$b" "$i"; find "$b" -name sheet*.xml -print0 | xargs -0 perl -p -i -e 's!<sheetProtect\w+ .+?/>!!g' ; find "$b" -name \*.bak -exec rm {} \; ; cd "$b"; zip -r "../done/$b - unprotected.xlsx" .; cd "$C"; rm -rf "$b"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment