Last active
December 21, 2021 09:30
-
-
Save marcobazzani/c545f453e60b232b8e16826caacc4c3f to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
set -e -u | |
FILE=$1 | |
NAME=$(echo "$FILE" | sed 's/\.[^.]*$//') | |
EXTENSION=$(echo "$FILE" | sed 's/^.*\.//') | |
rm -rf $NAME | |
rm -rf $NAME.zip | |
cp $FILE $NAME.zip | |
mkdir $NAME | |
cd $NAME | |
unzip ../$NAME.zip | |
sed -i '' -e 's~<sheetProte[^>]*>~~g' xl/worksheets/*.xml | |
sed -i '' -e 's~<workbookProte[^>]*>~~g' xl/workbook.xml | |
zip -r ../${NAME}_unprotected.zip . | |
cd - | |
mv ${NAME}_unprotected.zip ${NAME}_u.xlsx | |
rm -rf $NAME | |
rm -rf $NAME.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment