0

Attached screenshot Pls look at this

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);

                }
toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • Can you remove the Try..Catch and see on which line the Exception is thrown? – Tony Jul 14 '22 at 05:30
  • It seems the error is inside the ExcelOperations class which you haven't shared. – Tony Jul 14 '22 at 05:31
  • https://stackoverflow.com/questions/215026/the-located-assemblys-manifest-definition-does-not-match-the-assembly-reference Check this answer for the error which you're facing. – Tony Jul 14 '22 at 05:32
  • @Tony I tried, seems same issue occurs in filename – Marees Bala Jul 14 '22 at 05:33
  • Ah! You've used NuGet Package manager. I have had the same issue once with the NuGet package manager. I simply copied the DLL and placed it inside my source folder. Then I imported it by adding a reference to the DLL directly and it worked. You may have to remove the existing reference before that. – Tony Jul 14 '22 at 05:38

0 Answers0