TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dinesh Santhalingam
NA
737
369.1k
How to read a excel file in c#?
Jan 24 2017 4:26 AM
I have a excel file.I want to read the file using c#.
Excel file contains following.
Name subject Marks
A maths 35
B
maths 50
C
maths 69
------------Empty row-----------------
D maths 36
I am using Interop to read the Excel file .
i want my o/p like below.
Name subject Marks
A maths 35
B maths 50
C maths 69
D maths 36
What i did:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using
Excel
=
Microsoft
.Office.Interop.Excel;
namespace excel
{
class Program
{
static void Main(string[] args)
{
Excel.Application
xlApp
=
new
Excel.Application();
Excel.Workbook
xlWorkbook
=
xlApp
.Workbooks.Open(@"C:\dinesh\Sample.xlsx");
Excel.Worksheet
xlWorksheet
=
xlWorkbook
.Sheets[1]; // assume it is the first sheet
Excel.Range
xlRange
=
xlWorksheet
.UsedRange;
xlWorkbook.Worksheets.Add(xlWorksheet);
}
}
}
Reply
Answers (
20
)
create id with multiple prefix
Parallel Robocopy