Click here to Skip to main content
15,892,768 members

converting xls to csv. cannot split lines (using vb2005)

Alan Tuscano asked:

Open original thread
Hi,

I'm trying to save a converted xls file in csv.

--> after convert process
VB
Dim _Out() As String = csvData.Split("\n")

   Dim _OutPut As String = targetFile 'path and filename to save in local
   Dim _csv As StreamWriter = New StreamWriter(_OutPut, False)
   _csv.Write(csvData)
   _csv.Close(

)


Gives me this ressult below:
VB
ABCReferenceNo,ChequeDate,ChequeNo,DocRate,HouseBankCode,BankAcct,Project,ProjectName,Customer_OR_VendorCode,Customer_OR_VendorName,DocumentCurrency,Balance,\nABCRef1,20120131,1234,1,ABC01 USD,4808507000-22,A01102,Lente-Serenity Tower,V-J1036,CORJUVIT TRADING & CONSTRUCTION,USD,#VALUE!\nABCRef2,20120131,1235,1,ABC01 USD,4808507000-22,A01102,Lente-Serenity Tower,V-U1001,USAUK INC.,USD,#VALUE!\nABCRef3,20120131,1236,1,ABC01 USD,4808507000-22,A03101,ASIA oOne Corall Way,V-S1058,STARGATE MANUFACTURING CORP.,USD,#VALUE!\nABCRef4,20120131,1237,1,ABC01 USD,4808507000-22,A03101,ASIA oOne Corall Way,V-N1010,"NUEVA JAPAN HUMAN RESOURCES BUILDERS GROUP,INC.",USD,#VALUE!\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n,,,,,,,,,,,,\n


The result that should be is like this below:
VB
ABCReferenceNo,ChequeDate,ChequeNo,DocRate,HouseBankCode,BankAcct,Project,ProjectName,Customer_OR_VendorCode,Customer_OR_VendorName,DocumentCurrency,Balance
ABCRef1,20120131,1234,1,ABC01 USD,4808507000-22,A01102,Lente-Serenity Tower,V-J1036,CORJUVIT TRADING & CONSTRUCTION,USD,#VALUE!
ABCRef2,20120131,1235,1,ABC01 USD,4808507000-22,A01102,Lente-Serenity Tower,V-U1001,USAUK INC.,USD,#VALUE!
ABCRef3,20120131,1236,1,ABC01 USD,4808507000-22,A03101,ASIA oOne Corall Way,V-S1058,STARGATE MANUFACTURING CORP.,USD,#VALUE!
ABCRef4,20120131,1237,1,ABC01 USD,4808507000-22,A03101,ASIA oOne Corall Way,V-N1010,"NUEVA JAPAN HUMAN RESOURCES BUILDERS GROUP,INC.",USD,#VALUE!



I'm using VB2005. Please Help me
Tags: Visual Basic (Visual Basic 8 (2005), Visual Basic 9 (2008))

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900