How to use ExcelJS in Scheduled Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 08:35 AM
I'm trying to create a report that is formatted into table with a couple of worsheets in an excel workbook and found a post where someone suggested using ExcelJS.
Being new to JavaScript and ServiceNow, I'd like to know... Is it possible to include ExcelJS in a newly created script that I'm creating via selecting "All > System Definition > Scheduled Jobs > New > Select Automatically run a script of your choosing".
If so, how do I make ExcelJS accessible to the new scheduled script I'm creating?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 11:29 AM
Maybe a better question is... Where do you load the npm packages in ServiceNow so they can be used in a JavaScript include statement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
any update guys?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Unfortunately, you cannot directly include ExcelJS (or most external JavaScript libraries) in ServiceNow scheduled scripts in the traditional way you might expect. Here's why and what you can do instead:
Why ExcelJS Won't Work Directly
ServiceNow runs on a server-side Rhino JavaScript engine that doesn't support:
NPM package imports
Modern ES6+ module syntax (import/require)
Many Node.js-specific APIs that ExcelJS depends on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @Renee-17
To handle excel sheets in ServiceNow, may you try via GlideExcelParserScoped
In this document you be able to learn how to handle with a sheet or several one
If you want to load an excel in certain specific table may you try via Transform map
https://www.process.st/how-to/create-a-transform-map-in-servicenow/