Automating Password Protection for Excel Files Generated from ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi Everyone,
We have a requirement to generate an Excel file from ServiceNow containing information retrieved from a particular record. Currently, the process works as follows:
An Excel file is generated from ServiceNow based on the record's information.
The user downloads the Excel file.
The user manually sets a password to protect the Excel file.
The password-protected file is then reattached to the respective record in ServiceNow.
We are looking to automate this entire process, specifically the password-protection step, so that the Excel file generated from ServiceNow is automatically password-protected before it is downloaded or attached to the record, without requiring the user to manually enter or set a password.
We have a list of passwords maintained in a table within ServiceNow, and the password needs to be retrieved from that table and applied to the generated Excel file.
Has anyone implemented a similar solution in ServiceNow?
Is it possible to password-protect an Excel file directly through ServiceNow scripting (e.g., using Glide APIs or server-side scripts)?
Can this be achieved using a MID Server, or would an external utility/service be required?
If a MID Server is involved, how can we securely pass the Excel file and retrieve the password-protected version?
Are there any recommended approaches or limitations to consider?
Any guidance, suggestions, or examples of how this can be implemented would be greatly appreciated.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hey @Sahithi Ambati
ServiceNow does not provide a native Glide API to password-protect Excel files directly.
One possible approach is to use a MID Server with Apache POI or an external REST API.
The proposed workflow would be:
- Generate the Excel file from the ServiceNow record.
- Retrieve the corresponding password from the password table.
- Securely transfer the Excel file and password to the MID Server.
- Use a Java utility with Apache POI to apply password-to-open encryption.
- Return the encrypted Excel file to ServiceNow.
- Attach the password-protected file to the original record using GlideSysAttachment.
Alternatively, an external REST-based encryption service can be used instead of a MID Server.
************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
22m ago
Hello @Sahithi Ambati ,
As far as I know ootb ServiceNow doesn't support adding a password to exported Excel files, you would need an external script (like a MID Server or third-party API) to encrypt the file after it's generated.
Also, you try to attach the password protected Excel file back to a record, ServiceNow may block it. To allow encrypted .xlsx files to be attached, you will need to disable MIME type validation by setting the system property glide.security.file.mime_type.validation to false.
Check this out :
Password protected xls or pdf files not allowed
If my response helped mark as helpful and accept the solution.