I want to import data from Excel to object dynamically. How to read the data in Excel based on columns?
For example,
DataRowCollection drc = filteredRows.Rows; int totalRows = drc.Count; List<DynamicDataControllerModel.PurchaserExcel> target = new List<PurchaserExcel>(); for (int r = 0; r < totalRows; r++) {
DynamicDataControllerModel.PurchaserExcel pe = new PurchaserExcel(); pe.PurchaserIC = drc[r].Field<string>("Purchaser IC No"); <-- is there a way to make it more dynamic? like without caption sensitivity }
Thank You