-
File Formatting
I'm working on an application to import data from an Excel document (.csv)
to SQL Server database.
After doing my homework on working with instances of Excel, I've finally
realized that I can't make the assumption that Excel will be available on
the end machine... which brings me back home to a delimited file. My question...
Is there a way to convert a .csv file to a tab-delimited text file without
creating an instance of Excel? Of course, I can easily open it as comma
delimited, but since the some of the data itself contains commas, I need
to work with something different.
Any suggestions?
-
Re: File Formatting
You can go 2 ways here.
Open the file and replace the commas with tabs. Easy enough. Read the
contents into a string, then do Replace(sContents, ",", " ")
Or you could open the file in ADO/JET/Text ISAM into a recordset and just
dump the file to SQL server either using inserts (the slow way) or using my
really cool BULK INSERT class. You can get it here.
http://www.vbrad.com/pf.asp?p=Source/src_bcp.htm
--
Robert Gelb
www.vbRad.com
Source, Tips, Tricks, Components
"RHuber" <bobhuber@pacbell.net> wrote in message
news:3acb882b$1@news.devx.com...
>
> I'm working on an application to import data from an Excel document (.csv)
> to SQL Server database.
>
> After doing my homework on working with instances of Excel, I've finally
> realized that I can't make the assumption that Excel will be available on
> the end machine... which brings me back home to a delimited file. My
question...
>
> Is there a way to convert a .csv file to a tab-delimited text file without
> creating an instance of Excel? Of course, I can easily open it as comma
> delimited, but since the some of the data itself contains commas, I need
> to work with something different.
>
> Any suggestions?
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks