0

I have a Excel file .Which contains Something like Following

Name      Subject       marks
A         Maths                   30  
B         Maths          20  
C         Maths                   60  
D         Maths          35        

Here the values are not in a proper cell.I want to format the Excel .I want the result like below I mentioned.

 Name     Subject       marks
A         Maths          30  
B         Maths          20  
C         Maths          60  
D         Maths          35  

What I tried is:

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(@"d:\dinesh\sample.xlsx");
            Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[1]; // assume it is the first sheet 
            Excel.Range xlRange = xlWorksheet.UsedRange;
        }
    }
}

I don't know how to solve my problem.Please give some guidance to solve my issue.Thanks in advance.

Unformated Excel content

monica
  • 91
  • 3
  • 12

0 Answers0