ExcelScript Command to Protect Workbook (And Open in read-only mode)

Copper Contributor

Hi,

 

Is there an Excel Script command for Excel online which could enable the Protect Workbook function so that the file opens as read only?

 

To do this manually, the steps would be 

File > Info > Protect Workbook

 

EWLC_0-1629110759239.png

 

I have tried running workbook.getProtection().protect(); however this does not seem to enable this setting.

 

workbook.getProtection().getProtected() 

1 Reply
That command is unavailable to Office Script, you'll have to either protect the workbook in Desktop Excel or use Office JS to change that setting.