Home » Deeper in to NetSuite » Create Excel Sheet through Suitelet

Create Excel Sheet through Suitelet

Use the following sample code to create an XLS file in NetSuite’s Suitelet.

CTA - NetSuite Integration Connector Banner
// XML content of the file
var xmlStr = '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>';
    xmlStr += '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" ';
    xmlStr += 'xmlns:o="urn:schemas-microsoft-com:office:office" ';
    xmlStr += 'xmlns:x="urn:schemas-microsoft-com:office:excel" ';
    xmlStr += 'xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" ';
    xmlStr += 'xmlns:html="http://www.w3.org/TR/REC-html40">';

    xmlStr += '<Worksheet ss:Name="Sheet1">';
    xmlStr += '<Table>' +
    '<Row>' +
    '<Cell><Data ss:Type="String"> Folio3 Pvt. Ltd </Data></Cell>' +
    '<Cell><Data ss:Type="String"> Products </Data></Cell>' +

    xmlStr += '<Row>' +
    '<Cell><Data ss:Type="String">1</Data></Cell>' +
    '<Cell><Data ss:Type="String">NetSuite EBay Connector</Data></Cell>' +

    xmlStr += '<Row>' +
    '<Cell><Data ss:Type="String">2</Data></Cell>' +
    '<Cell><Data ss:Type="String">NetSuite Magento Connector</Data></Cell>' +

    xmlStr += '<Row>' +
    '<Cell><Data ss:Type="String">3</Data></Cell>' +
    '<Cell><Data ss:Type="String">NetSuite Salesforce Connector</Data></Cell>' +

    xmlStr += '<Row>' +
    '<Cell><Data ss:Type="String">4</Data></Cell>' +
    '<Cell><Data ss:Type="String">Smart Database Connector</Data></Cell>' +

    xmlStr += '<Row>' +
    '<Cell><Data ss:Type="String">5</Data></Cell>' +
    '<Cell><Data ss:Type="String">NetSuite EBay Motors Connector</Data></Cell>' +

    xmlStr += '</Table></Worksheet></Workbook>';

//create file
var xlsFile = nlapiCreateFile('sample.xls', 'EXCEL', nlapiEncrypt(xmlStr, 'base64'));

// folder id in which the file file will be saved
xlsFile.setFolder('< folderid >');

//save file
var fileID = nlapiSubmitFile(xlsFile);

Get In Touch With Our Experts

    Get In Touch With Our Experts

      I have read and agree to the Privacy Policy of Folio3
      I agree to be contacted by Phone or Email by Folio3

      Get in touch with the


      End-to-end NetSuite Servicing Agency

      Tell us how may we assist you!