Write csv with double quotes

I’m writing a datatable to a csv file, each filed shouled enclosed in double quotes. But it doesn’t work for me. The content in csv is without double quotes.
My steps concluded as follows:

  1. executequery, extracet data from DB by a sql and store the result in a Datatable.
  2. writecsvfile, write the Datatable into a csv file
    The target is : “AccountFile_100001_20191106”,“15947”
    But the reality is : AccountFile_100001_20191106,15947

How to deal with it. Someone can help is appricated. Thanks anyway.

1 Like

HI @whzhu

While writing the code use ASCII code for double quotes for get in the texts.

Cheers ! :slight_smile:

Don’t use the write csv activity, use “Append Line”. Loop through the DT, write line by line adding quotes. See attached XAML for working project.Main.xaml (7.7 KB)

@PaulNel, it works. thanks.
However, there’re many headers, so that the codes in “Write Line” are a little bit tedious.
Acutally, I read the post Link two days ago. The writor said that the “double quotes” generated automatically when he use “write csv” activity.
So I think whether there is easier way to accomplish it.
Thanks anyway. Cheers!