Это видео недоступно.
Сожалеем об этом.

How to read Excel files in C#

Поделиться
HTML-код
  • Опубликовано: 25 янв 2022
  • A quick guide showing how to read Excel files using C#! We create a simple CSharp application that will read values from cells.
    First we include the Excel Interop Assembly, then we create a custom function that creates an instance of the Excel object. From there we continue on to get cell values and show them in a message box.
    If you are just starting to learn to program, then this video will help you! Reading from Excel documents can be very helpful!
    You can read *.xls/*.xlsm and more excel formats!
    tags: c# read excel file,read excel file in c#,how to read excel file in visual studio,c# open excel file,read data from excel in c#,how to read excel file in c# windows application,c# read excel,how to,c# excel tutorial - #1 - open and read excel files,bospear programming,Fox Learn,how to get data from excel file in c#,c# read excel file into datatable,reading excel sheet in c#,reading excel sheets in c#,reading .xlsx file in visual studio,how to reade xls file in c#
    #excel #Csharp #programming

Комментарии • 30

  • @christiangibbs8534
    @christiangibbs8534 Год назад +4

    Thanks very much. The other tutorials and articles made this SO much more complicated than it needed to be!

  • @user-ic9jp9sr1q
    @user-ic9jp9sr1q Год назад +3

    Я конечно не понимаю английский, но этот человек объяснил работу с excel гораздо понятнее чем другие блогеры на русском.

  • @nakorns320
    @nakorns320 2 года назад +2

    Simply and good teaching, thank you, sir.

  • @raduparfenie8383
    @raduparfenie8383 6 месяцев назад +1

    Well done! Clear and concise.

  • @gruzifigs
    @gruzifigs 7 месяцев назад

    finally someone who writes logical codes

  • @valoire
    @valoire Год назад +2

    using Excel = Microsoft.Office.Interop.Excel will allow you to shortcut the explicit declaration every time; just a tip :)

    • @DarrenG
      @DarrenG  Год назад +4

      Hey that's awesome! Thanks!

  • @BaldurTheWhite
    @BaldurTheWhite Год назад

    This worked for me. Thank you so much. It was plain and simple.

  • @melanieschneider8158
    @melanieschneider8158 2 года назад +1

    Thanks, that saved me so much reading

  • @1pomii
    @1pomii 2 года назад +1

    needed this for my job, thank you!

    • @DarrenG
      @DarrenG  2 года назад +1

      I was doing it for mine and figured I would make a one off app showing how to do it lol

  • @ghostprogramming
    @ghostprogramming 4 месяца назад

    What to do with that?
    Cannot convert source type 'object' to target type 'Microsoft.Office.Interop.Excel.Worksheet'

  • @letenyeidam89
    @letenyeidam89 2 года назад +1

    Thank you!

  • @xsandwichxxsandwichx1778
    @xsandwichxxsandwichx1778 2 года назад +1

    I like your style

  • @BCTAHbKA
    @BCTAHbKA 2 года назад

    Bu, ən yaxşı videodur

  • @claymore2000
    @claymore2000 Год назад

    How do export this to the end user? I’m working ok similar stuff for my economy guys and they aren’t tech savvy at all.
    Is it easiest to export this code as an .exe?

  • @dbest19330
    @dbest19330 2 года назад

    Well done :)

  • @coding_ideas
    @coding_ideas 2 года назад +1

    thanks

  • @igorthelight
    @igorthelight Год назад

    Working and commented code (it's a Console application tho):
    using System;
    using Microsoft.Office.Interop.Excel;
    namespace ExcelParser
    {
    internal class Program
    {
    static void Main(string[] args)
    {
    ReadExcel(@"C:\sheet.xlsx");
    Console.ReadKey();
    }
    static void ReadExcel(string filename)
    {
    Application excel = new Application();
    Workbook wb = excel.Workbooks.Open(filename);
    Worksheet ws = wb.Worksheets[1];
    // Reading one cell
    //Range cell = ws.Cells[1, 1]; // Less human friendly way
    Range cell = ws.Range["A1"];
    Console.WriteLine(cell.Value);
    // Reading the whole row or column
    Range cells = ws.Range["A1:A3"];
    foreach (string item in cells.Value)
    {
    Console.WriteLine(item);
    }
    wb.Close();
    }
    }
    }

  • @robertsimpson7857
    @robertsimpson7857 Год назад

    What if you reading a cell with a date? what changes will you make to the code? A new learner

  • @rashmiverma2326
    @rashmiverma2326 2 года назад

    Hi, can you tell how to read password protected Excel file?

  • @zolitik21
    @zolitik21 Год назад

    The "Workbook" word underline the c# in my project

  • @mfsalatino
    @mfsalatino Год назад

    when i try to read it appearme this error System.MissingMemberException: 'Public member 'Value' on type 'Range' not found.'.
    what can i do ?

  • @jonatasviana4041
    @jonatasviana4041 2 года назад +1

    Salve me, obrigado

  • @fabianralph5472
    @fabianralph5472 Год назад

    'Cannot convert type 'char' to 'string'' how to fix?

  • @JoWood2000
    @JoWood2000 2 года назад

    Why I am getting a "System.__ComObject" instead of text from cell?

    • @DarrenG
      @DarrenG  2 года назад

      Maybe you are reading the cell instead of the cell's value. That's my guess.

    • @JoWood2000
      @JoWood2000 2 года назад

      @@DarrenG Thank you for your answer but I fixed that problem. Greetings from Poland :)