I have been wanting to convert a CSV to Excel in S...
# suitescript
b
I have been wanting to convert a CSV to Excel in Suitescript for a while. I tried SheetJS but it seems like it needs to load the whole file for processing so there's a size limit of 10MB. I don't see a way to stream it into SheetJS. I was able to figure out a solution but I am curious how everyone else is overcoming that limitation? I might write a blog post about my solution if I find it to be an improvement over others.
👀 1
r
I would be interested in that blog post
✅ 1
b
will probably require some variation of using file iterators or readers to make a giant string, sheet js doesnt do streaming for its input
essentially only a synchronous read
you can probably do something like creating the worksheet directly from each line instead of making sheet js parse the giant string
that would make a difference in memory management since you wouldnt have 2 large objects in memory at the same time
m
You can include minified js in suitescripts??
e
Sure
minified js is still js
It just has to be AMD-compatible
m
AMD compatible?
Oh Asynchronous Module Definition.
✅ 1
b
@battk Yeah, that's pretty much what I ended up doing since I couldn't figure out a way to use SheetJS for those giant files
My method still has its limits but I was able to handle a 100 MB file fine
I'll write a blog post about it later. Thanks everyone for your input!