We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CSV format - Remove Double Quotes

Hi,

I am Saving data coming from database -> into a Datatable then importing into a
worksheet and saving it in CSV format.
I am actually saving the file in MapPath first and opening a dialog box and
having user save it whereever they want to.

the code looks like this:-

Protected Sub btn_Import_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Import.Click
excelEngine = New ExcelEngine()
appl = excelEngine.Excel
workbook = appl.Workbooks.Create(3)
Dim strpath1 As String = Server.MapPath("Import")
Comments:-GetDataToCSVFile()
Method call is very simple in selecting 4 columns from a sql table and out of it 3 are varchar columns and one is int-:Comments
Dim mycsvdatatable As DataTable = GetDataToCSVFile()
sheet = workbook.Worksheets(1)
sheet.ImportDataTable(mycsvdatatable, False, 1, 1)
sheet.SaveAs(strpath1 & "\" & "Sample.csv", ",", Encoding.ASCII)
Comments:-Opens a dialog box to
save-:Comments

Response.Redirect("~\Import\" & "Sample.csv", False)
End Sub

Attached CSV file has Text/varchar columns (Columns B,C,D in attached file) in Quotes.As i mentioned above 3 columns they are enclosed in Double Quotes in CSV file. May i know Why? Is there any way to remove them via Sync's save as() method

In another example for CSV file i got from your forums:-
I see the format to save the file is different- there is no encoding parameter?
workbook.SaveAs(Server.MapPath("sample.csv"),"/t");

Are the Double quotes due to saving format as Encoding.ASCII?

Regards,
Vidya



Sample_50df277f.zip

1 Reply

GM Geetha M Syncfusion Team September 25, 2008 12:38 PM UTC

Hi Vidya,

Thank you for your continued interest in Syncfusion products.

I am afraid that I am not able to reproduce the problem. You can get the test sample I created based on the above code snippets in the below link:

http://websamples.syncfusion.com/samples/XlsIO.Web/6.3.1.8/I49986/main.htm

Please try running the above sample and let me know if you are able to see the problem at your end.

Also, I am able to see the problem only when I am not setting the Encoding as ASCII. So, could you please let me know the regional settings of your environment?

Regards,
Geetha


Loader.
Live Chat Icon For mobile
Up arrow icon