We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to quickly read the summary information of a big excel file

Hi, there,

Here is what I would like to do for a big size excel file:

If I open one existing excel file by using stream, how do I know how many rows and columns in a a given worksheet(for example worksheets[0])? and can I load the only 10 records of that worksheet instead of the whole data to save time if the file size is very big?

Thanks

Hi Jerry,


Thank you for contacting Aspose support.

While working with spreadsheets having large data set, we strongly recommend you to use the Memory Preferences to minimize the memory utilization for the overall process. You can alternatively choose to load only a specific worksheet in order to process it further. However, you cannot load partial data from a worksheet.

Please check the following code snippet demonstrating the use of Aspose.Cells for .NET API to load only the first worksheet from a given workbook.

C#

//Create an instance of LoadDataOption & set properties
LoadDataOption dataOption = new LoadDataOption();

//Set LoadDataOption to load only first worksheet
dataOption.SheetIndexes = new int[] { 0 };

//Set LoadDataOption to import formulas
dataOption.ImportFormula = true;

//Create an instance of LoadOptions
LoadOptions loadOptions = new LoadOptions();

//Specify the LoadDataOption for the object of LoadOptions
loadOptions.LoadDataOptions = dataOption;

//Create a Workbook object and opening the file from its path
Workbook book = new Workbook(“d:/Source.xlsx”, loadOptions);

Please note, the Memory Preferences have been supported with the release of Aspose.Cells for .NET 8.0.0, so if you are currently using an older version of the API, you have to upgrade it to use these advanced settings.

Hi Jerry,


Adding more to my previous response, if your requirement is to read specific cells from a large spreadsheet, you may also opt to use the the LightCells API. Please check the below linked detailed article on this subject.
http://www.aspose.com/docs/display/cellsnet/Using+LightCells+API