Created
April 26, 2022 03:09
-
-
Save mustafabutt-dev/04bb689cc441f60d0e909e78964a9e12 to your computer and use it in GitHub Desktop.
code snippet to import XML data into Excel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create sheet from stream(e.g. xml to xlsx) | |
var aspose = aspose || {}; | |
//get the aspose.cells module in to your project. | |
aspose.cells = require("aspose.cells"); | |
// load the fs module for reading/writing files | |
var fs = require("fs"); | |
// creates the read stream of the source file | |
var readStream = fs.createReadStream("myxml.xml"); | |
// accepts the data stream and populates/import XML data into Excel file | |
aspose.cells.Workbook.createWorkbookFromStream(readStream, function(workbook, err) { | |
if (err) { | |
console.log("open workbook error"); | |
return; | |
} | |
// save the file | |
workbook.save('result.xlsx'); | |
console.log('Successfully imported XML file to Excel'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment