You must Sign In to post a response.
  • Category: .NET

    How to get specific columns data from excel

    Hi Team,

    I would like to get some portion of excel data to be placed in grid view.

    In Excel, first row contains main heading and data starts from second row.

    Summary of Changes from Data Dictionary V128 (March 2016) to V129 (April 2016) --1st row
    Change Location Change Description Code Comment --second row()
    CBA&F The following Function has been created: --3rd row

    Tabular data starts from second row. I need only data in 2 columns namely(Change description and Code).

    when I'm using select Change Description,Code from SheetName. getting exception like there is no name Change Description.

    kindly help me.

  • #768185
    Hi Sreeja,

    You can try this free excel library to get the specific data:

    I created an example for your reference:
    using System;
    using Spire.Xls;

    namespace Get_specific_column_data_from_excel
    class Program
    static void Main(string[] args)
    Workbook workbook = new Workbook();
    Worksheet sheet = workbook.Worksheets[0];
    //Get the data of the 2nd column
    foreach (CellRange range in sheet.Columns[1].Cells)

  • #768206
    Hai Sreeja,
    You need to use Range function which can retrieve the data from the specific columns.

    foreach (CellRange range in sheet.Columns["ColumnName"].Cells)
    // range.Value will give the value

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • Sign In to post your comments