Nevron .NET Vision
Chart for .NET / User's Guide / Data Manipulation / Importing / Importing From Excel File

In This Topic
    Importing From Excel File
    In This Topic

    The data contained in the data series can be imported from a excel file. This functionality is exposed to the user via ReadAll and ReadRange methods of NExcelReader class.

    Note that these methods returns DataSet object, which tables should be additionally imported to the data series via NDataSeries.FillFromDataTable method or bound using NDataBindingManager.

     Using NExcelReader class.

    NExcelReader class allows you to read the content of a whole excel file or a specified range of cells in a particular excel sheet.

    When whole file was read each sheet of the file is transformed to a DataTable in the result DataSet with a Name equal to the name of the sheet.

    The user can pass a string with a file name or a Stream as a source of the data.

    C#
    Copy Code
    string filename = //the name of the excel file. 
    string sheetName = // the name of the sheet. 
    
    DataSet excelData = new NExcelReader().ReadAll(filename); 
    … 
    DataSet excelData = new NExcelReader().ReadRange(filename, sheetName, "A1:E3");
    
    Visual Basic
    Copy Code
    Dim FileName As String = 'The name of the excel file. 
    Dim SheetName As String = 'The name of the sheet. 
    
    Dim ExcelData As DataSet = New NExcelReader().ReadAll(Filename)
    … 
    Dim ExcelData As DataSet = New NExcelReader().ReadRange(Filename, SheetName, "A1:E3")
    
     Related Examples
    Windows forms: All Examples\Data Manipulation\Importing\From Excel File.