Send data from Excel to Notepad!

Send data from Excel to Notepad using a C# program.....

Page 1 of 1

0 Replies - 2670 Views - Last Post: 19 January 2010 - 02:27 AM Rate Topic: -----

#1 coldfire101  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-January 10

Send data from Excel to Notepad!

Posted 19 January 2010 - 02:27 AM


I need to write a program to send data from a particular excel sheet in a workbook to a notepad. Say,I've an xl sheet with the following columns: "Name,Age,Salary" with values "john,24,1000" respectievely,Now I need a C# program to read the xl sheet and write the values onto the Notepad (in Tab separated format) as follows: John 24 1000.
I need to write all the columns in the xl sheet into the notepad as follows.

Before I ask any help,let me make it clear that I'm a beginner to this stuff,and while I have done some programs dealing with the likes of 'fibonnacci' & 'prime numbers',they were all part of the curriculum and I've learnt all of em by Rote methodology..... Please help me regarding the above program.I have tried to do it myself and here's what I have till now...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Excel;

namespace datt
	class Program
		static void Main(string[] args)
			DataSet ds = new DataSet;
			DataTable dt = new DataTable "table1";
			DataColumn dc_col1 = new DataColumn("trigger term")
			DataColumn dc_col2 = new DataColumn("news1")
			DataColumn dc_col3 = new DataColumn("news1url")
			DataColumn dc_col4 = new DataColumn("news2")
			DataColumn dc_col5 = new DataColumn("news2url")

				DataRow newrow = dt.newrow;

				FileStream f1 = new FileStream("C:\List_Answer_Production\AU_States_V1.xls",FileMode.Create);
				byte b[] = File.ReadAllBytes("C:\List_Answer_Production\AU_States_V1.xls");
				FileStream f1 = new FileStream("C:\List_Answer_Production\Austates.txt",FileMode.Create);



Is This A Good Question/Topic? 0
  • +

Page 1 of 1