Pipe Delimited CSV

I have a csv file where 1 line is pipe delimited with not double quotes and another line is pipe delimited but with double quotes.


For eg. Line 1 could be
No|Fruit|Date|Qty|Description
while line 2 is
12134|“apple”|2014.07.04 00:00:00|“pink lady"

I am using code below
Dim txtLoadOptions As TxtLoadOptions = New TxtLoadOptions()
txtLoadOptions.Separator = Convert.ToChar(”|")
Dim workbook As Workbook = New Workbook(filename, txtLoadOptions)

However, for the first line it will separate out the line into separate cells but the second line will only use 1 cell. What should I be doing?

Hi,

Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells for .NET 8.1.1 it is working fine with your text file.

I have tested it with the following code and attached the output xls file generated by it for your reference.

VB.NET


Dim txtLoadOptions As TxtLoadOptions = New TxtLoadOptions()

txtLoadOptions.Separator = Convert.ToChar(“|”)

Dim workbook As Workbook = New Workbook(“test.txt”, txtLoadOptions)

workbook.Save(“output1.xls”)