How to check column labels of CSV file before loading into import set table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 10:56 PM
We want to check csv column headers before loading into import set. We are loading file from RITM to data source and from data source we are loading the file.
For excel using parser and header column we can get details of header. But for CSV there is no such method to get header details.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 04:37 AM
Hello @dhanu3 ,
Could you please let me know if you got some solution to this ?
I am having some similar requirements where i need to check the column header(s) for a CSV file before importing the same to Import Set Table.
Thanks & Regards,
Pankaj Chakraborty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 04:43 AM
Hi Pankaj,
Yes. I have used below script to read CSV file.
var gsa = new GlideSysAttachment();
var bytesInFile = gsa.getBytes('sys_data_source', dataSourceID); // Please enter data source sys id in dataSourceID
var originalContentsInFile = Packages.java.lang.String(bytesInFile); // originalContentsInFile
originalContentsInFile = String(originalContentsInFile);
var ar = [];
ar = originalContentsInFile.split(',');
ar will give you content of your file then using for loop and indexof you can read columns.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 04:56 AM
Thank you so much. It helped to some extent.