How to get row count of attached excel sheet in catalog form in service now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2019 12:44 AM
How to get row count of attached excel sheet in catalog form in service now

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2019 03:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2019 05:40 AM
Thanks for Reply!!
Actually my requirement is Count the number of rows in the attached excel sheet on the catalog form.
For example:
I attached one excel under that 4 rows data filled.Then auto populated in the variable field as 4.
Kindly help me on the same
Thanks for Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 11:38 AM
Hi Author,
Did you find anything on your requirement. I have a similar one.
Regards,
Monika Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 12:07 PM
Hi,
Try using something as below in background script once.
var count=0;
var parser = new sn_impex.GlideExcelParser();
var attachment = new GlideSysAttachment();
// use attachment sys id of an excel file attachment
var attachmentStream = attachment.getContentStream('6b420a9b2fc454101baee93df699b66a'); //sys_id of record from sys_attachment table
parser.parse(attachmentStream);
//retrieve the column headers
var headers = parser.getColumnHeaders();
var key = headers[0];
var value = headers[1];
while(parser.next())
{
count++;
var row = parser.getRow();
//print row value for both columns
//gs.print(row[key] + ': ' + row[value]) ; //Uncomment this to get actual data.
}
gs.print('Number of Rows in excel attached are '+count);
Thanks,
Jaspal Singh