Search code examples
javascriptnetsuitesuitescript

How to create EXCEL and WORD file using SuiteScript 2.0?


I'm using HTML Suitelet to create Word and Excel, I'm able to create CSV and PDF files but I am unable to create a Word or Excel. How do I do it?

file.create({name:'testinvoice.pdf',fileType:file.Type.PDF, contents:pdffile.getContents()});

Solution

  • Take a look at the file.Type enum in the help center. file.Type.WORD and file.Type.EXCEL are both supported, but your file.Create may be failing because the contents may not be create. I think this stack overflow question will be helpful with creating an XLS file: Create Excel File in NetSuite's SuiteScript