C# Excel Tutorial – #1 – Open and Read Excel Files

42 Comments

  1. For those who have problem finding the reference, they can find the dll at C:WindowsassemblyGAC_MSILMicrosoft.Office.Interop.Excel15.0.0.0__71e9bce111e9429c

  2. hey I unable to run it successfully please why don't you show from the beginning?

  3. i am not able to read cells. i tried copying excel file to source of this code too.

  4. could you please share the source code?..

  5. Hi, experienced but rusty programmer here… The program runs but no message. When I debug/trace the steps in Form1.cs, it never gets past InitializeComponent(); it goes to program.cs (Main) and ends after Application.Run(new Form1())

  6. How to Import data to data gridview using this code?

  7. Thanks, great video.

  8. ASMR MOUTHSOUNDS FOR TINGLE IMMUNITY 👄👅

  9. This guy has way too much saliva.

  10. Great tutorial.. But I am having a problem.. I can't get the MessageBox to show up.. I have gone over the code 1000 times now, it is exacly the same as shown in the video.. I get no errors when compiling and the form1 window pops up, but not the message box. I have tryd moving the TEST.xlsx to diffrent locations and add it to the path line.. Any clue? Would like to continue with the tutorials, but not until I know it works for me xD

    Ps. Also tryd running VS as admin.

  11. Thank you so much ! I used this codes in my app. But I need to count my rows . How can I do that ?

  12. I am having troubles with Value2 and the Excel type in the form1. Can anyone give me some sugestions please

  13. Where are the first steps for creating this project ? unfortunately not helpful for those who want to create from scratch

  14. WHERE IS THE FILE NAMED "Test.xlsx " SAVED

  15. Gods, as someone with misophonia I gave this vid an honest try, but had to duck out at like 40 seconds.

  16. i did everything like you`ve shown but i am getting only this window https://i.imgur.com/hhordz7.png

  17. Thanks for the tutorial. but I got this error:

    System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).'

    Why? plz Answer Me….

  18. Why don't you show us Form1.cs code?

  19. I'm getting the error:

    System.InvalidCastException

    HResult=0x80004002

    Message=Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Workbook'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208DA-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

    Source=<Cannot evaluate the exception source>

    StackTrace:

    <Cannot evaluate the exception stack trace>

  20. Do you not have to preface wb, ws and excel with 'this' in C# within the Excel constructor?

  21. what happend with your "soooooooooo" … fack !

  22. @Bospear. How do you implement the Application Interface? I'm getting errors when using the _Application syntax.

  23. help me, plesase : An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WpfApplication1.exe

  24. it's useful!!!,thank you!

  25. in the part where it is done the pucblic Excel etc etc i have a problem. Visual studio said that i need a return, but u dont have a return in this part. What i can do?

  26. The program '[32304] ConsoleApp2.exe' has exited with code 0 (0x0).

  27. Thanks for the tutorial. but I got this error:
    System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).'

    Why?

  28. Why in .NET 3.5 or less than my app don't read Excel file
    this's my mistake:" Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Excel.Worksheet'. An explicit conversion exists (are you missing a cast?)".
    Thank you. Guy

  29. try this one https://www.theskysoft.com/batch-excel-workbook-binder.html

  30. Thanks & Best regards

  31. what Csharp version you're working with?

  32. Hi Bospear
    I am confusing that why you have both Excel.cs and Program.cs in the same time?

  33. sir is it possible to open microsoft publisher also using visual studio 2017? coz i need to print the data in visual studio 2017 using publisher. please help me TIA

  34. I follow your step but when i run it's says
    System.InvalidCastException: 'Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).'

  35. Hey. Do you have any suggestions on how I can read an Excel file with merged cells using EPPlus? Basically I have a value that should be in one cell spreaded across three merged cells. I've got this problem for a whole column and the Excel cannot change. Any ideas?

  36. DONT FORGET TO CLOSE THE WORKBOOK

    Always close a file after opening it…

  37. Hey Bospear dos this work with asp.net mvc?

  38. Thank you man, you saved me

Leave a Reply

Your email address will not be published. Required fields are marked *