Free Support Forum - aspose.com

Help with getting data from an Excel spreadsheet

I'm trying to build a page that will pull the data from an Excel Spreadsheet with five columns and a variable number of rows. I've tried looking at the example site (http://www.aspose.com/demos/.net-components/aspose.cells/csharp/quick-start/data/export-data.aspx) and I get several errors when I try to implement that code. One of my coworkers has suggested that it may be out of date.

I'm curious if anyone can help me find good code examples of someone using Aspose.Cells for what I'm trying to do.

Thanks

Hi,

Thanks for using Aspose.Cells for .NET.

Yes, Live Demos are just for demonstration purpose and they use older version. We maintain same demos in Offline Version which are updated regularly.

Please check the export-data.aspx (cs) file for the demo code.

Please download and try the latest offline demos. These demos can work with Visual Studio 2005, 2008 or 2010. Please read the readme.txt file before running the demos.


Also I have posted the your particular upgraded demo code below. Please also see the following documentation articles for your reference.


C#

//Instantiate a new workbook

Workbook workbook = new Workbook(path);


//Get the first worksheet in the workbook

Worksheet worksheet = workbook.Worksheets[0];


//Create a datatable

DataTable dataTable = new DataTable();


//Export worksheet data to a DataTable object by calling either ExportDataTable or ExportDataTableAsString method of the Cells class

dataTable = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxRow + 1,

worksheet.Cells.MaxColumn + 1);