Attached screenshot Pls look at this
Using the NuGet Package ExcelDataReader
I tried to simply open up a .xlsx file. Here is the code used:
Exceloperations.PopulateInCollection(@"C:\Users\Devcare\Desktop\DB.xlsx";
public static void PopulateInCollection(string filename)
{
DataTable table = ExcelToDataTable(filename);
// totalRowCount table.Rows.Count;
for (int row = 1; row <= table.Rows.Count; row++)
{
for (int col = 0; col < table.Columns.Count; col++)
{
Datacollection dtTable = new Datacollection()
{
rowNumber = row,
colName = table.Columns[col].ColumnName,
colvalue = table.Rows[row - 1][col].ToString()
};
dataCol.Add(dtTable);
}