473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

save a excel file as a tab delimited text file

Hi all
i am trying to save a excel file as a tab delimited text file. can i
do it some how?

i using the code

_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows ,Type.Missing,Type.Missing,Type.Missing,Type.Missi ng,Type.Missing,Type.Missing,Type.Missing);

Kindly assist
regards
shantanu

Jun 15 '07 #1
7 18265
Hi Shantanu,

have a look at http://www.codeproject.com/cs/database/CsvReader.asp .
Might help you.

Regards
Rainer

"shantanu" <sh***********@gmail.comschrieb im Newsbeitrag
news:11**********************@e9g2000prf.googlegro ups.com...
Hi all
i am trying to save a excel file as a tab delimited text file. can i
do it some how?

i using the code

_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows
,Type.Missing,Type.Missing,Type.Missing,Type.Missi ng,Type.Missing,Type.Missing,Type.Missing);

Kindly assist
regards
shantanu


Jun 15 '07 #2
On Jun 15, 11:55 am, "Rainer Queck" <Rai...@noemail.noemailwrote:
Hi Shantanu,

have a look athttp://www.codeproject.com/cs/database/CsvReader.asp.
Might help you.

Regards
Rainer

"shantanu" <shantanuse...@gmail.comschrieb im Newsbeitragnews:11**********************@e9g2000pr f.googlegroups.com...
Hi all
i am trying to save a excel file as a tab delimited text file. can i
do it some how?
i using the code
_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows
,Type.Missing,Type.Missing,Type.Missing,Type.Missi ng,Type.Missing,Type.Miss*ing,Type.Missing);
Kindly assist
regards
shantanu- Hide quoted text -

- Show quoted text -
hi thanks
but i have a excel file with two coloumns A and B and i have to write
the coloumn values in two diffrent lines in a text file with tab
delimiters.
regards
shantanu

Jun 15 '07 #3
"shantanu" <sh***********@gmail.comwrote in message
news:11**********************@e9g2000prf.googlegro ups.com...
i am trying to save a excel file as a tab delimited text file. can i
do it some how?

i using the code

_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows
,Type.Missing,Type.Missing,Type.Missing,Type.Missi ng,Type.Missing,Type.Missing,Type.Missing);
Please show your full code...

It looks like you are trying to use server-side Office Automation, which
won't work:
http://support.microsoft.com/default...US;q257757#kb2
--
http://www.markrae.net

Jun 15 '07 #4
On Jun 15, 1:00 pm, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"shantanu" <shantanuse...@gmail.comwrote in message

news:11**********************@e9g2000prf.googlegro ups.com...
i am trying to save a excel file as a tab delimited text file. can i
do it some how?
i using the code
_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows
,Type.Missing,Type.Missing,Type.Missing,Type.Missi ng,Type.Missing,Type.Miss*ing,Type.Missing);

Please show your full code...

It looks like you are trying to use server-side Office Automation, which
won't work:http://support.microsoft.com/default...US;q257757#kb2

--http://www.markrae.net
hi Thanks
here is the code

#region "Open Development Plan Sheet"
private void OpenDPS()
{
try
{
int i;
string[] arrPlanned;
string[] arrMilestone;

int cellloc=0;

Excel.Range testRng, test;
Excel.Range XLSrange,xlsRngPlanned,xlsRngMilestone;
Excel.Range ProjNo,ProjNm;
_book = OpenExcelWorkbook(strXlsFile);
_sheet = (Excel.Worksheet)_book.ActiveSheet;
_sheet.Select(Type.Missing);

Excel.Worksheet _shtOut = (Excel.Worksheet)_book.Worksheets[1];
while(_shtOut.Name != "DevelopmentPlan")
{
_shtOut = (Excel.Worksheet)_shtOut.Next;
}

XLSrange = _shtOut.UsedRange;

ReadPRPTemp();

arrPlanned = new string[arrHeader.Length];

for (i = 16 ; i <= XLSrange.Rows.Count ; i++)
{
xlsRngPlanned = _shtOut.get_Range("C" +
i.ToString(),Type.Missing);
if(xlsRngPlanned.Value!=null)
{
arrPlanned[i]= xlsRngPlanned.Value.ToString();
}
else
{
arrPlanned[i] = "";
}
}

arrMilestone = new string[arrHeader.Length];

TextWriter t = new StreamWriter(@"C:\PRP\PRPTemp.xls");
foreach(string s in arrHeader)
{
t.Write(s.ToUpper() + "\t");
}
t.Close();

for (int l = 16 ; l <= XLSrange.Rows.Count-1 ; l++)
{
xlsRngMilestone = _shtOut.get_Range("B" +
l.ToString(),Type.Missing);
if(xlsRngMilestone.Value!=null)
{
arrMilestone[l] = xlsRngMilestone.Value.ToString() +
".PLANNED";
}
else
{
break;
}
}
ProjNo = _shtOut.get_Range("H6",Type.Missing);
ProjNm = _shtOut.get_Range("H7",Type.Missing);

_book1 = OpenExcelWorkbook(@"C:\PRP\PRPTemp.xls");
_sheet1 = (Excel.Worksheet)_book1.ActiveSheet;
_sheet1.Select(Type.Missing);

TextWriter twr = new StreamWriter(@"C:\WINDOWS\Temp
\PRPLogin.txt");
twr.WriteLine("1");
twr.Close();

Excel.Worksheet _shtOut1 = (Excel.Worksheet)_book1.Worksheets[1];
testRng = _shtOut1.UsedRange;

_shtOut1.get_Range("A2",Type.Missing).Value = ProjNo.Value;
_shtOut1.get_Range("B2",Type.Missing).Value = ProjNm.Value;

//MessageBox.Show(testRng.Columns.h);
for(int x = 1;x<= testRng.rows.Count; x++)
{
test = _shtOut1.get_Range("A" + x.ToString(),Type.Missing);
if(test.Value!=null)
{
for (int l = 16 ; l <= XLSrange.Rows.Count-1 ; l++)
{
xlsRngMilestone = _shtOut.get_Range("B" +
l.ToString(),Type.Missing);
xlsRngPlanned = _shtOut.get_Range("C" +
l.ToString(),Type.Missing);
if(xlsRngMilestone.Value!=null)
{
if(test.Value.ToString() == xlsRngMilestone.Value.ToString() +
".PLANNED" )
{
cellloc = x;
_shtOut1.get_Range("B" + x.ToString() , Type.Missing).Value =
xlsRngPlanned.Value;
}
}
else
{
break;
}
}
}
}

_book1.Save();
_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows,Typ e.Missing,Type.Missing,Type.Missing,Type.Missing,T ype.Missing,Type.Missing,Type.Missing);

_sheet1 = null;
NAR(_sheet1);
ExcelApp.ActiveWindow.Close(false,@"C:\PRP\PRPTemp .xls",false);
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
#endregion

Jun 15 '07 #5
"shantanu" <sh***********@gmail.comwrote in message
news:11**********************@q19g2000prn.googlegr oups.com...
>Please show your full code...

It looks like you are trying to use server-side Office Automation, which
won't
work:http://support.microsoft.com/default...US;q257757#kb2

here is the code
Excel.Range testRng, test;
_book = OpenExcelWorkbook(strXlsFile);
_sheet = (Excel.Worksheet)_book.ActiveSheet;
_sheet.Select(Type.Missing);
As I suspected, this is server-side Office Automation which won't work:
http://support.microsoft.com/default...US;q257757#kb2

Fetch the data from the worksheet using ADO.NET:
http://www.google.co.uk/search?sourc...22ADO%2eNET%22
--
http://www.markrae.net

Jun 15 '07 #6
On Jun 15, 1:59 pm, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"shantanu" <shantanuse...@gmail.comwrote in message

news:11**********************@q19g2000prn.googlegr oups.com...
Please show your full code...
It looks like you are trying to use server-side Office Automation, which
won't
work:http://support.microsoft.com/default...US;q257757#kb2
here is the code
Excel.Range testRng, test;
_book = OpenExcelWorkbook(strXlsFile);
_sheet = (Excel.Worksheet)_book.ActiveSheet;
_sheet.Select(Type.Missing);

As I suspected, this is server-side Office Automation which won't work:http://support.microsoft.com/default...US;q257757#kb2

Fetch the data from the worksheet using ADO.NET:http://www.google.co.uk/search?sourc...hl=en-GB&ie=UT...

--http://www.markrae.net
hi
But how i am going to put it again in a text file in tab delimited
format
regards
shantanu

Jun 15 '07 #7
"shantanu" <sh***********@gmail.comwrote in message
news:11**********************@i38g2000prf.googlegr oups.com...
But how i am going to put it again in a text file in tab delimited
format
1) Fetch the data from Excel using ADO.NET into a DataSet or maybe an
OleDbDataReader

2) Instantiate a TextWriter object

3) Iterate through the rows of the data object

4) For each row, write a line to the TextWriter object

MyTextWriter.WriteLine(<RowObject>[0].ToString() + "\t" +
<RowObject>[1].ToString());
--
http://www.markrae.net

Jun 15 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dixie | last post by:
I have a copy of a tab delimited text file that was created from an excel spreadsheet. I want to try to emulate this text file using Access 2000. I don't have access to the spreadsheet, but do...
2
by: Kenneth Koski | last post by:
Hello All, I have a comma delimited text file, which I would like to move into a SQL 2000 table . I created a DTS package in SQL Server and saved it as a VB.bas . I am writting the code in C#...
1
by: The Bear | last post by:
I have populated a dataset with a tab delimited text file. When the changes are made in the dataset, I then want to write those changes from the dataset to a tab delimited text file. How do I write...
0
by: TJS | last post by:
attempting to read a delimited text file into a dataset using oledb text file connection getting this error message when trying to open connection...
4
by: JustSomeGuy | last post by:
Hi. I have a comma delimited text file that I want to parse. I was going to use fscanf from the C library but as my app is written in C++ I thought I'd use the std io stream library... My Text...
1
by: Quentin | last post by:
I want to take a comma delimited text file and export it to excel format, using the comma as the delimiter. Any help on this would be great, thank you.
4
by: Ted Theo | last post by:
hello cdma enthusiasts. long time no speak. i have an .adp which is connected to a sql 2k back end from which i need to export a table to a tab delimited text file. the export text wizard...
1
by: Stefan Behnel | last post by:
Gibson wrote: Use iterparse() instead of parsing the file into memory completely. untested: for _, item in etree.iterparse('catalog.xml', tag='Item'): # do some cleanup to save memory...
0
by: rhonda6373 | last post by:
Is it possible to change the format of an Excel file to a pipe delimited text file? How can I do that? Thanks in advance!
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.