No video

How to read Excel files in C#

  Рет қаралды 40,390

Darren Does Everything

Darren Does Everything

Күн бұрын

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 Жыл бұрын
Thanks very much. The other tutorials and articles made this SO much more complicated than it needed to be!
@raduparfenie8383
@raduparfenie8383 6 ай бұрын
Well done! Clear and concise.
@gruzifigs
@gruzifigs 7 ай бұрын
finally someone who writes logical codes
@nakorns320
@nakorns320 2 жыл бұрын
Simply and good teaching, thank you, sir.
@user-ic9jp9sr1q
@user-ic9jp9sr1q Жыл бұрын
Я конечно не понимаю английский, но этот человек объяснил работу с excel гораздо понятнее чем другие блогеры на русском.
@BaldurTheWhite
@BaldurTheWhite Жыл бұрын
This worked for me. Thank you so much. It was plain and simple.
@melanieschneider8158
@melanieschneider8158 2 жыл бұрын
Thanks, that saved me so much reading
@1pomii
@1pomii 2 жыл бұрын
needed this for my job, thank you!
@DarrenG
@DarrenG 2 жыл бұрын
I was doing it for mine and figured I would make a one off app showing how to do it lol
@valoire
@valoire Жыл бұрын
using Excel = Microsoft.Office.Interop.Excel will allow you to shortcut the explicit declaration every time; just a tip :)
@DarrenG
@DarrenG Жыл бұрын
Hey that's awesome! Thanks!
@xsandwichxxsandwichx1778
@xsandwichxxsandwichx1778 2 жыл бұрын
I like your style
@letenyeidam89
@letenyeidam89 2 жыл бұрын
Thank you!
@ghostprogramming
@ghostprogramming 4 ай бұрын
What to do with that? Cannot convert source type 'object' to target type 'Microsoft.Office.Interop.Excel.Worksheet'
@BCTAHbKA
@BCTAHbKA 2 жыл бұрын
Bu, ən yaxşı videodur
@dbest19330
@dbest19330 2 жыл бұрын
Well done :)
@coding_ideas
@coding_ideas 2 жыл бұрын
thanks
@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?
@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(); } } }
@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 ?
@user-mw8tg3gx8x
@user-mw8tg3gx8x Жыл бұрын
I got similar error message
@zolitik21
@zolitik21 Жыл бұрын
The "Workbook" word underline the c# in my project
@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?
@fabianralph5472
@fabianralph5472 Жыл бұрын
'Cannot convert type 'char' to 'string'' how to fix?
@fabianralph5472
@fabianralph5472 Жыл бұрын
I literally copy all your methods
@jonatasviana4041
@jonatasviana4041 2 жыл бұрын
Salve me, obrigado
@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 :)
How to write Excel files in C#
7:20
Darren Does Everything
Рет қаралды 31 М.
Creating Excel Files in C#
55:42
IAmTimCorey
Рет қаралды 126 М.
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 53 МЛН
Pool Bed Prank By My Grandpa 😂 #funny
00:47
SKITS
Рет қаралды 20 МЛН
А ВЫ УМЕЕТЕ ПЛАВАТЬ?? #shorts
00:21
Паша Осадчий
Рет қаралды 1,5 МЛН
C# Excel Tutorial - #1 - Open and Read Excel Files
7:04
Bospear
Рет қаралды 365 М.
C# Read CSV - Tutorial
12:21
Nick Proud
Рет қаралды 7 М.
Python in Excel vs. VBA - What You Should Learn in 2024!
10:05
David Langer
Рет қаралды 39 М.
c# - это просто. Работа с Excel файлом через Interop.Excel
17:25
How to read data from an excel file with C# using Excel Data Reader
8:50
Azhar Techno Coder
Рет қаралды 9 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 155 М.
Excel File to DataGridView Import | C# | WinForms | Part One
9:53
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 53 МЛН