0

Fetching Contents from Excel File Attached to your record:

var parser = new sn_impex.GlideExcelParser();

var getAttachment = new GlideSysAttachment();

// use attachment sys id of an excel file attachment

var attachmentStream = getAttachment.getContentStream('attachment_sys_id');

parser.parse(attachmentStream);

//retrieve the column headers

var headers = parser.getColumnHeaders();

var key = headers[0];

var value = headers[1];

//var obj = {};

while(parser.next()) {

var row = parser.getRow();

//print row value for both columns

gs.log(row[key] + ': ' + row[value]) ;

}

How to parse excel file in ServiceNow using GlideExcelParser() Function
Working Code Asked question July 4, 2023