Created
November 29, 2022 11:45
Revisions
-
conholdate-gists renamed this gist
Nov 29, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
conholdate-gists created this gist
Nov 29, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ var fs = require('fs'); var aspose = aspose || {}; aspose.cells = require("aspose.cells"); // Instantiate an instance of the LoadOptions class and set the format to CSV. var loadOptions = new aspose.cells.LoadOptions(aspose.cells.LoadFormat.CSV); // Load CSV file by initializing the constructor by Workbook class. var workbook = new aspose.cells.Workbook( "sample.csv", loadOptions); // Invoke the getLastCell method to get the last cell in this worksheet. Returns null if there is no data in the worksheet. var lastCell = workbook.getWorksheets().get(0).getCells().getLastCell(); // Set exporting range to json by calling the ExportRangeToJsonOptions method. var options = new aspose.cells.ExportRangeToJsonOptions(); // Call the createRange method to create a Range object from a range of cells. var range = workbook.getWorksheets().get(0).getCells().createRange(0, 0, lastCell.getRow() + 1, lastCell.getColumn() + 1); // Export the range to json file by calling the exportRangeToJson method. var data = aspose.cells.JsonUtility.exportRangeToJson(range, options); // Display JSON console.log(data);