Comma-Delimitted Text File to Excel

I would like someone to explain me with detail if there's any component or rutine to convert a comma-delimitted text file into a excel sheet.

Thanks very much.
LVL 1
quiqueAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JoeBoothCommented:
Some questions to consider:

Is Excel on the machine that will be doing the conversion?  If so, you can use the COM objects that come with Delphi 5 to create Excel spreadsheets.

If Excel is not installed, or if you'd prefer not to use COM, consider the following component (it sells for $30).

http://www.axolot.com/components/xlsreadwrite.htm

This component allows you to write cells directly to Excel files and works great.  I am a very happy customer of the component.  

If you purchase the component, you can use the ASCII driver to read the text file and use the components methods to write the cells..
0
quiqueAuthor Commented:
I have Delphi 4 and I don't want to purchase any product.

There's must be an easier way to do it!
0
simonetCommented:
Excel already reads CSV files.

Alex
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

men xinCEOCommented:
following
0
JoeBoothCommented:
Will Excel be installed on the machine that is running the conversion?
0
quiqueAuthor Commented:
Yes, it will be installed.
0
JoeBoothCommented:
If Excel will be installed, you can use the Excel OLE automation object for the conversion.  Unfortunately, I do not have any sample code showing how to do it.  If someone else does provide sample code, I'll see if I can dig it up from my home office.
0
quiqueAuthor Commented:
But remember what I have is a text file delimitted by commas, not a stringgrid or even an array or something like that. I only want to conver that text file into an excel sheet without "disturbing" the user
0
Phoenix_sCommented:
excel already imports CSV files with no problems... no need to write a conversion routine
0
quiqueAuthor Commented:
Phoenix, I don't want the user to work at all!
0
GreymanCommented:
1)Drop an OLEContainer on your form.

2) In the relevant bit of code:

OLEContainer1.CreateObject('Word.Application',True);
OLEContainer1.OLEObject.Workbooks.Open('MyFile.csv',null,2,null..[lots of nulls here - check the programmer's help in Excel for the exact interface].);
OLEContainer1.OLEObject.Workbooks[1].SaveAs(See the Excel help for exact usage);

Have a look under TOLEContainer in the Delphi help, and in the Excel reference under the Workbooks object for more.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
quiqueAuthor Commented:
Greyman, I'll try it and tell you.

Quique.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.