none
Dynamically picking up data from Excel RRS feed

  • General discussion

  • How to dynamically pick up data from Excel?

    For example, I want to pick up data suppose for Production environment and different cells? How to achive that?

    Help will be truely appreciated.

    • Moved by CoolDadTx Friday, March 1, 2019 2:52 PM Office related
    Friday, March 1, 2019 12:45 PM

All replies

  • Hello,

    • How are you working with Excel e.g. OleDb, Excel automation, Open XML for Excel, external library?
    • What version of Excel e.g. .xlsx
    • Are you working from one Excel file with one WorkSheet or ?
    • What are the constraints e.g. specific range, specific column etc ?
    • Is this desktop or web server or local server?

    To really give a proper reply you need to expand on your details starting with the above.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, March 1, 2019 1:31 PM
  • A simple way to do it is use EPPLUS.  There are tons of examples on reading and creating Excel files like this one.

    • Edited by mogulman52 Friday, March 1, 2019 2:54 PM
    Friday, March 1, 2019 2:52 PM
  • I have used a free product Spire.XLS, which supports reading the contents of cell and exporting data from excel. Below is my code for your reference.

     

    Nuget link:https://www.nuget.org/packages/FreeSpire.XLS/

    Spire.Xls.Workbook wb = new Spire.Xls.Workbook();
    wb.LoadFromFile("F:\\test.xlsx");
    Spire.Xls.Worksheet sheet = wb.Worksheets[0];
    //get the content of the cell
    sheet.Range["A2"].Text.ToString();
    Spire.Xls.CellRange range = sheet.Range[sheet.FirstRow, sheet.FirstColumn, sheet.LastRow, sheet.LastColumn];
    //export data
    DataTable dt = sheet.ExportDataTable(range, true, true);

    Regards

    Anna


    • Edited by Anna zyg Tuesday, March 5, 2019 8:31 AM
    Tuesday, March 5, 2019 8:26 AM