
Announcements
Hello!
Whenever I run my office script manually from excel itself, the sheet protection is paused/resumed.
However, whenever the script runs on power Automate flow(Run a script), the protection doesn't get paused or resumed.
Please find the script below. I have the correct password in the script but have hidden it here:
function main(workbook: ExcelScript.Workbook) {
let sheetNames = ["AUTOMATE WH", "AUTOMATE HP+"];
sheetNames.forEach(sheetName => {
let sheet = workbook.getWorksheet(sheetName);
if (sheet) {
sheet.getProtection().pauseProtection('*****')
console.log(`Sheet "${sheetName}" protection paused.`);
} else {
console.log(`Sheet "${sheetName}" not found.`);
}
});
}
Thanks in advance for any help you can provide!
Hi, I was having the same problem and I could not find out a way to make the pauseProtection and resumeProtection to work with Power Automate. Thus, I decided to use protect and unprotect, and it worked.