Could we create a xlsx/xls file with image in it u...
# suitescript
b
Could we create a xlsx/xls file with image in it using 'n/file' module?
Copy code
var xmlString = '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>'; 
        xmlString += '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" ';
        xmlString += 'xmlns:o="urn:schemas-microsoft-com:office:office" ';
        xmlString += 'xmlns:x="urn:schemas-microsoft-com:office:excel" ';
        xmlString += 'xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" ';
        xmlString += 'xmlns:html="<http://www.w3.org/TR/REC-html40>">'; 
        
        xmlString += '<Worksheet ss:Name="Sheet1">';
        xmlString += '<Table>' + 
                   '<Row>' +
                    '<Cell><Data ss:Type="String"> First Header </Data></Cell>' +
                    '<Cell><Data ss:Type="String"> Second Header </Data></Cell>' +
                    '<Cell><Data ss:Type="String"> Third Header </Data></Cell>' +
                    '<Cell><Data ss:Type="String"> Fourth Header </Data></Cell>' +
                    '<Cell><Data ss:Type="String"> Fifth Header </Data></Cell>' +
               '</Row>';
        
        xmlString += '<Row>' + 
                                '<Cell><Data ss:Type="String">Row 1 Column 1</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 1 Column 2</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 1 Column 3</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 1 Column 4</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 1 Column 5</Data></Cell>' + 
                      '</Row>';
        
        xmlString += '<Row>' + 
                                '<Cell><Data ss:Type="String">Row 2 Column 1</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 2 Column 2</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 2 Column 3</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 2 Column 4</Data></Cell>' + 
                                '<Cell><Data ss:Type="String">Row 2 Column 5</Data></Cell>' + 
                      '</Row>';
        
        xmlString += '</Table></Worksheet></Workbook>';
        var xlsxFile = file.create({
            fileType:file.Type.EXCEL,
            folder: -5,
            contents: base64EncodedString,
            name: "Testing.xlsx"
        });
But not sure how to add image to the cell