473,395 Members | 1,452 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,395 software developers and data experts.

Null Values when exporting Excel to CSV using OLEDB

I have a 4 column, 6 row Excel sheet with all cells formatted for text:
1 1 a a
2 2 b b
3 3 c c
a 4 d 1
b 5 e 2
c 6 f 3

I have the following schema.ini:

[ADP.csv]
ColNameHeader=True
CharacterSet=1252
Format=CSVDelimited
Col1=F1 Char Width 255
Col2=F2 Char Width 255
Col3=F3 Char Width 255
Col4=F4 Char Width 255

I achieved this schema.ini by editing the one created by .NET. It
originally consisted of 3 lines that contained FLOAT for datatype.

When I create a CSV file using OLEDB and .NET, I get the following
1 1 a
2 2 b
3 3 c
4 d 1
5 e 2
6 f 3

In a column, only text or only numbers work fine. Mixed types omit the text.
Here is my OLEDB code line that builds the CSV file

Connection string = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Temp\Book1.xls;Extended Properties="Excel 8.0;HDR=NO;"

Dim oCmd As New System.Data.OleDb.OleDbCommand("SELECT * INTO
[Text;DATABASE=C:\Temp].[ADP.csv] FROM [sheet1$]", oConn)

I did review
http://msdn.microsoft.com/library/de...a_ini_file.asp

but it did not help. What can I do to force the text cells not to be null
in columns that also contain numbers formatted as text. XLS, CSV, and INI
are all in same folder.

Aug 16 '06 #1
0 2010

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

Similar topics

2
by: Bertrand | last post by:
Hello, I am trying to archieve the following: - copy an excel file present on the server - insert values into named ranges of the copy I am using Excel97 on my PC, the server does not have...
3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
2
by: G | last post by:
When I export data from access to excel by with "export" or "Analyze with" I seem to loose parts of some fields (long text strings). Is there a way to export it all to excel? Thanks G
2
by: Mike P | last post by:
How do you go about exporting data in excel to a C# dataset? Any help would be really appreciated. Cheers, Mike
1
by: NancyA | last post by:
I am using the following code to write data from a datagrid to an Excel file: Dim tw As New System.IO.StringWriter Dim hw As New System.Web.UI.HtmlTextWriter(tw) dg.RenderControl(hw)...
2
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the...
8
by: Edgar | last post by:
Tools: SQL Server 2K, Excel 2000 Hi, I have an Excel report worksheet with formatted headings. What I want to do is to export data from the SQL server into a specific cell of the excel file....
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
2
by: KC Eric | last post by:
Hi all, I am trying to export the content of a datagrid to Excel format (xls) in a Windows Application, I google a bit, but the examples I found were focus on ASP.net, using the response...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.