Does anyone have a link or a sample on how to crea...
# suitescript
m
Does anyone have a link or a sample on how to create an Excel file from Suitescript other than the one in SuiteAnswers? I am looking at ways to output data in their "appropriate" format (String, date, number, currency). The SA only shows string, but all my values when I open excel are pure "strings", including dates and numbers
n
I’ve used the excelJS library before to do this. It’s worked well
m
let me look into it! I usually try to avoid library because of all the terms of use and legal stuff. but maybe i can find how they do it
s
Just so you know, XSLX files are actually a Zip archive containing multiple folders and XML files. Make a very simple one in Excel, save it, then rename to .zip and extract it to see the basic structure yourself. I have written code to build them from scratch before (in another language, not JS), and honestly would not want to repeat it. The library option is probably best.
m
yeah i always suggest CSV, but what I am trying now is just putting a few saved searches in different tab. without any formatting/highlighting. Just trying to get the cells to be actual dates/number/currency instead
s
You can also use the much older and more limited Excel 2003 XML format, which is a single XML file, but if I recall right it had some limitations or issues, especially with multiple sheet spreadsheets, and I was forced to use the newer format. For a hand-coded approach, that’s probably the only format worth attempting.
m
yeah im not picky on the xls vs xlsx. im just trying to get a date from a NS saved search to show up as a Date in excel, and the same for integers
m
@Nathan L did you use exceljs client or server-side?
I tried and failed to get it working server side
n
Server side. There is a build file that contains the entire project that you load into your suitescripts folder and reference like a custom module
m
Used SheetJS instead, now they even have a page in documentation for NetSuite
n
oh thats way better
m
The free version doesn't have formatting options (colours, fonts etc..)
n
Thats actually the same way i mentioned. But its nice they put together good instructions for it. @Mark if you havent already, then i would go with what michoel suggested
m
Thanks, will look into it!