C# Tutorial - How to read excel file | FoxLearn

preview_player
Показать описание
How to read excel (*.xls,*.xlsx) file using ExcelDataReader c# excel programming tutorial c# windows forms application.

The c# basics beginner course is a free c# tutorial series that helps beginning programmers learn the basics of the c# programming language.

Through this video you will learn the following topics:

Read Excel File in C# Example
how to read excel file in c# windows application
best way to read excel file in c#
C# Open and Read Excel Files
C# How To Get Data From Excel File In C#
C# Programming - Reading in a File from Excel
How to import excel file to DataGridView in c#
How to Open Excel File in C#
C# DataGridView Excel Load Data From Excel File
How to read an Excel file using C#
How to read data from excel file using c#
Open and read Excel file from C#
C# Read Data From Excel File
c# excel parser, c# import excel file, c# open excel workbook
read data from excel in c#
c# excel read cell value, read excel sheet in c#
Комментарии
Автор

first of all thanks for the video.
I have a problem with '' IsFirstRowColumnNames '', it says // IExcelDataReader' does not contain a definition for 'IsFirstRowAsColumnNames' and no extension method 'IsFirstRowAsColumnNames' accepting a first argument of type 'IExcelDataReader' could be found (are you missing a using directive or an assembly reference?) //

gokhaneycan
Автор

ty a been searching like crazy for solution.

UsmanShery
Автор

Thank you! .. your tutorials are very helpful. I know you can, that's why we ask you to make a tutorial showing us how to select only certain columns from an excel sheet to be imported into datagridview.
Thank you in advance!

raduluchian
Автор

An unhandled exception of type !!!
how can i fix it ?

zouhairnaji
Автор

i have a problem (reader) return from openfiledialog with null???

abdalluharef
Автор

Congratulation by vídeo, Is possible use the filter in datas?

edsonferraz
Автор

Hello, can you please help me with the source codes. The screen is so blurry and can't see certain of the codes. Fortunately, what you're doing is pretty much part of my software development assessment. Thanks

emmanuelbollie
Автор

for those who want to use the first row as column for datagrid
use this
using ExcelDataReader;
using System;
using System.Data;
using System.IO;
using System.Windows.Forms;

namespace ReadmyExce_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

DataSet result;
private void button1_Click(object sender, EventArgs e)
{
using (OpenFileDialog of = new Work Book 97-2003|*.xls|Excel Workbook|* .xlsx", ValidateNames=true })
{
if(of.ShowDialog() == DialogResult.OK)
{

FileStream fs = File.Open(of.FileName, FileMode.Open, FileAccess.Read);
IExcelDataReader reader;
if (of.FilterIndex == 1)
reader =
else
reader =



result = reader.AsDataSet(new ExcelDataSetConfiguration() {
ConfigureDataTable = (tableReader) => new ExcelDataTableConfiguration()
{
UseHeaderRow = true // set to true to use excel first row as column in datagridview
}

});

comboBox1.Items.Clear();
foreach(DataTable dt in result.Tables)
{


}
reader.Close();


}
}
}

private void sender, EventArgs e)
{
dataGridView1.DataSource =
}
}
}

fennelsoft
Автор

and how we can for example modify some rows and colums and then add it to the datagridview and then print it ??
thanks for the nice video and also yur help

انامسلموكفى
Автор

i see there is a step Skip in line 30 after entering FileStream fs, what did you do there ???? to reference class
 i did everything as in video but still i cant find any reference to classes even after installing nuget pakages

help me to fix this..

ashokr
Автор

How do I edit content on a existing csv or excel file?

muziwenhlanhladlamini
Автор

hello, i have a problem how can i import files from excel to c# using listview not datagridview is there any way?

bernardcasimiro
Автор

thanks for source code
on modifying the filter from xls to xlsx it shows a null reference exception

SuperGiantbug
Автор

Followed all the steps, and started VS as an Administrator. When I rebuild the solution I get the following error message on the console :
Severity Code Description Project File Line Suppression State
Warning Could not copy "obj\Debug\ReadExcel.exe" to "bin\Debug\ReadExcel.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\Debug\ReadExcel.exe' because it is being used by another process. ReadExcel

Any idea what could be wrong ?

sudeepagrawal
Автор

this code keeps giving me the error 'Object reference not set to an instance of an object.' result was null. " can you please tell me how to fix it?
thanks

daniciro.
Автор

Hi I follow up your programs, in this I have an error in "UseHeaderRow = true". How to Correct it, Plz advice. Thanks.

monirajv
Автор

How can we read file .xlsx on this reader ?
Whats changes we have to import on this source code ?
Ty

_para_dev
Автор

sir i am getting red line under .xls and code after that
plz tell me the reason and solution

swethasankendla
Автор

u should tell what namespaces have u added...

alishagoyal
Автор

An unhandled exception of type occurred in for each ...

rotan