Microsoft Office Password Protected Files

Hi all,

Wondering if there’s a definitive way to check if a given folderItem has password security on it - on MacOS in the Finder, icons are displayed with a padlock on them, so MacOS itself must have some inner workings to establish this.

I’ve been using ‘file -b’ and parsing the results, but as time goes on a newer version of office are released, the description returned varies and isn’t always captured by my code. I keep having to update it every now and then.


You could of course use LibXL functions to open the Excel file and see if you get an error.

Or since modern Excel files are Zip files, do a listing with out Archive classes and see what’s inside.
You may spot a difference between with and without password.

1 Like