14 minutes Read

Published On

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>' +
    '</Row>';

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

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

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

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

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

    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);

Table of Contents

Contact Us

By submitting this form, you agree to our privacy policy and terms of service.

Related resources you might be interested in

We'd love to help you with all your NetSuite needs

Folio3 Your Top Choice:

Middle East Partner 2025
education award 2025
Winner Award
Software and IT Services 2024
Financial-Services-2023
SuiteCommerce 2023

Let's discuss your NetSuite needs

Hello, How can we help you?