hello,
I need to load an excel file in a Dataset and read the Datatable(s) witch I'm expecting will match each Worksheet of the Workbook.
From there i'm good to parse the data I need.. do you guys have a way to load the data in DataSet or any other Object.. a c# sample will be gratly appreciated.
Thanks
demetan
October 30, 2006, 11:36am
3
hello,
What ever i try whit this particular file... it always give me a null value in any range i try to retreive from the sheet and to show in the grid...
This is an important file for me to parse... why it give that result.. i cant read any of the data...
The DataTable result is a bunch of NULL value... whatever the selection i try to do in the sheet..
Code exemple :
public DataTable GetExcelData(string fileToProcess)
{
try
{
//Datatable Object
DataTable dt = new DataTable();
//Instantiating an Workbook object
Workbook workbook = new Workbook();
//Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(fileToProcess, FileMode.Open);
//Opening the Excel file through the file stream
workbook.Open(fstream);
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Exporting the contents of x rows and x columns starting from 1st cell to DataTable
dt = worksheet.Cells.ExportDataTableAsString(23, 0, 1, 2, false);
//Closing the file stream to free all resources
fstream.Close();
//return result
return dt;
}
catch (Exception ex)
{
throw (ex);
}
}
I don't find any problem with your file. Which version of Aspose.Cells are you using?
I create a sample winform project and attach it here. Please unzip to your driver D.
Some columns do have null values because they are merged and don't have data in them. All cells with data are exported correctly.