Export to CSV with column header labels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 01:45 PM
I was trying to export a report in CSV. Generally when data is exported in CSV the column headers will be the element names(like short_description), but my requirement is to get the column labels as column headers.
Can anyone help me achieve this CSV export?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2015 07:46 AM
Maybe a custom processor is what you are looking for. This will get you started:
Service-now Processors and Platform Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2015 03:15 PM
Hi Mike, Thank you for the info. That was really helpful.
I was trying some code and its not woking.
var rows = [];
var gr = new
GlideRecord('table_name');
- gr.query();
// add column headings
for (each e in gr)
row.push(gr.e.getLabel().replace('"',''));
- rows.push('"'+row.join('","')+'"\r\n');
while (gr.next()) {
var row = [];
for (each e in gr)
row.push(gr.getValue(e).replace('"','')); // must escape double quotes;
rows.push('"'+row.join('","')+'"');
}
var csv = rows.join('\r\n');
Can you provide me some code I can work it out?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2017 12:50 PM
Hello Kumar, were you ever able to get this working? did you apply any other solution.
I have a similar need and would love your input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2019 11:03 AM
You should be able to use this property to control the behavior:
glide.export.csv.column_header_label