I think only SheetJS library is capable of generat...
# suitescript
a
I think only SheetJS library is capable of generating valid/standard xls files but I remember looking into that a few years ago and you have to pay or it was a big nigthmare, not even sure if that is usable in NetSuite.
s
Yeah, it's been a pain so far.
d
I got SheetJS to work a couple years back (in context of NetSuite serverside), though I recall having to troubleshoot & modify some of the core src files myself to finally get it working so was a bit of a "nightmare" - but did eventually successfully generate Excel files at least (might require less/no intervention now with SS2.1 though)
just to vouch that I think it is at least possible 😂 if that helps any
s
So i do have SheetJS running in 2.1. Do you happen to remember how you saved it? My issue right now is saving it in the file cabinet as an excel file content in a rest api
d
looks like I just saved to the fileCabinet with
file.Type.EXCEL
and .xlsx extension
s
how did you get the content? Did you do xlsx.write()?
d
yah
Copy code
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.json_to_sheet(wsData, headerObj);
// ...
XLSX.utils.book_append_sheet(wb, ws, ...)
// ...
var wb_file = XLSX.write(wb, {
    type: 'base64',
    bookType: 'xlsx'
});
var excelFile = file.create({
    name: 'sample.xlsx',
    fileType: file.Type.EXCEL,
    contents: wb_file,
});
s
awesome! Ok very similar. I was trying to return the data in postman and save it. I'll see if that works. Thanks!
t
if you setup a serverless hook you can probably find more libraries in node