Luis
04/08/2025, 10:01 PMalien4u
04/08/2025, 10:14 PMLuiz Morais
04/09/2025, 9:43 AMLuiz Morais
04/09/2025, 9:46 AMvar fileContent = '<?xml version="1.0"?>'
fileContent += '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"';
fileContent += ' xmlns:o="urn:schemas-microsoft-com:office:office"';
fileContent += ' xmlns:x="urn:schemas-microsoft-com:office:excel"';
fileContent += ' xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"';
fileContent += ' xmlns:html="<http://www.w3.org/TR/REC-html40>">';
fileContent += '<Worksheet ss:Name="Orders">';
fileContent += '<Table>';
//Header
fileContent += '<Row>';
fileContent += '<Cell><Data ss:Type="String">Order #</Data></Cell>';
fileContent += '</Row>';
//Lines
search.load({id: 'customsearch_fs_f16_fr_ups'}).run().each(function(result){
result = JSON.parse(JSON.stringify(result));
fileContent += '<Row>';
fileContent += '<Cell><Data ss:Type="String">' + result.values['GROUP(tranid)'] + '</Data></Cell>';
fileContent += '</Row>';
return true;
});
fileContent += '</Table></Worksheet></Workbook>';
var base64EncodedString = encode.convert({
string: fileContent,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.BASE_64
});
var excelFile = file.create({name: createFileName(), fileType: 'EXCEL', contents: base64EncodedString});
excelFile.folder = [FOLDER_ID];
excelFile.save();
Luis
04/11/2025, 10:19 AMborncorp
04/14/2025, 6:29 AM