convert csv save as excel file problem
Hi, i'm converting my csv file to xls file in vb.net . I have following code and everything runs well without a problem. however when i finish running my app and open my .xls file to check the data, i found an additional unwanted column was added to the excel file named "F8". does anyone know what causes this problem? Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & impStr & ";Extended Properties=Excel 8.0;") ExcelConnection.Open() Dim ImportCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Sheet1] FROM [Text;DATABASE=C:\Web].[" & csvStr & ".csv]", ExcelConnection) ImportCommand.ExecuteNonQuery() ExcelConnection.Close() Return True Michael Z
December 20th, 2010 10:48pm

Can you provide your csv file?Craig Bryden - Please mark correct answers
Free Windows Admin Tool Kit Click here and download it now
December 20th, 2010 11:03pm

yes, heres some example with title column Part Number,Manufacturers Code,Product Name,Stock,Price,Category,Brand AUDCRE0104,70SB104000003,Creative Sound Blaster X-Fi Xtreme PCIe Audio Retail Package Win 7 24-Bit/96kHz 7.1 Playback >108dB 24-bit/96kHz recording X-Fi Crystalizer,2,95,Audio/MP3/Sound ,Creative, actually i figured out , as i was writing code in vb to create this csv file, i added a "," after the last column on each line. so when excel converts the csv it taken that as another column without a proper name. let me know if i'm wrong though.Michael Z
December 20th, 2010 11:27pm

That is exactly what I thought the issue was. I thought you might have a column in the data that didn't have a column header. Craig Bryden - Please mark correct answers
Free Windows Admin Tool Kit Click here and download it now
December 20th, 2010 11:32pm

thank you very much for pointing that out :) Michael Z
December 20th, 2010 11:39pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics