Need help with excel attachment

Chinmayee1
Giga Contributor

Hi , I m trying to write an attachment to a record. If I do it with the below code its executing fine with csv format. but when I trying to write it using xlsx its not giving the report in the correct format. Is there any difference in the input format for xlsx?

var attach = new GlideSysAttachment();

var attachFile = attach.write(table object,filename,+".csv",application/csv,data); // prints fine

if I replace csv with xlsx it doesn't print in the correct format.I even tried using JSON name value pair but no luck.

Can anyone please advise ?

5 REPLIES 5

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Can you explain what you mean with "doesn't print in the correct format"? For me this looks to be working fine.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn