Write/Read/Append CSV - delimitator

Hi,

Would it be possible to open the Delimitator argument to values others than Comma and Semicolon (preferably open Char/Char field)?
Currently it’s fine for simple files, but with free text fields in the data I needed to roll a separate activity to be able to have less standard delimiters (the ones that are not normally used by humans at all, like | pipe).

Regards.

8 Likes

Bump - I’m getting PM’s for this (sidenote - please bump the thread instead, thanks :slight_smile: ), so it seems to still be relevant.

3 Likes

@andrzej.kniola, thanks for pointing this out.
I have exactly the same need, with the same rationale ( | pipe doesn’t show up often in free text fields - although these two messages are exceptions :grinning:). I like the idea of Char also for multiple-character delimiters - I can’t recall offhand having seen ‘||’ ever, which should make it nearly bulletproof. Would come in very handy indeed.
Regards,
burque505

1 Like

It’s planned, maybe in 18.1 or 18.2

I’m using 2018.1.1 CE Studio, it would be great if the delimitator could be specified as a character. I have a CSV file with ‘~’ symbol as delimitator. Any ideas? (other than Invoking code)

You must have already tried, but If only for reading. (unless it doesn’t mess file format)

CSV can be read using Read Text File activity – Output string

Replace your ~ with comma(or Semicolon)

write back to a temp file Write Textfile – but csv path

now use CSV to read temp file with Comma into a DataTable

1 Like

@vvaidya you have a very good thought process. As you mentioned I tried the read Text file and replacing the ~ symbol but I was trying to write it directly to CSV and got stuck.

Thanks so much…:slightly_smiling_face: This works for now. I am still going to look out for the CSV activities to enable the developers to specify the delimitators.

hey @PD2
There’s also a cool trick where if you concatenate “sep=~” at the top you can specify the delimitter.
I don’t know if this bit of information is helpful now for what you need, but your text file would look like this:

sep=~
a~b~c~d
e~f~g~h

Then when you save it in .CSV format it will open in Excel correctly.

To be honest, though, I would just replace the delimitter :stuck_out_tongue:

1 Like

Hi @PD2, you’re obviously not alone in wishing for a broader range of delimiters within the activity, and @Cosin says it’s planned.

Until it gets here, you might try this free (for personal and commercial use) program written in AutoHotkey, CSVBuddy, which should lend itself to automation within UiPath Studio also. It’s very light on resources. You could also run the source code with a ‘Run Auto Hot Key Script’ activity.

Even that may be overkill, given @vvaidya and @ClaytonM’s workarounds, but maybe …

Regards,
burque505

1 Like

Hello guys. In the next release the Activity will be changed to support custom delimiters.

3 Likes

@Cosmin_Ion_Nicolae, thank you!
That’s really good news.
Regards,
burque505

In addition, you should be able to indicate that all string fields should be wrapped with quotes. Currently there is no way to control that, and most often no quotes are present, which poses a problem when writing out, say, zipcodes (07052 will be read by Excel as the numeric 7052; losing the leading zero). This happens even though the datatable column is defined as string.

1 Like

Hi can i know the script to use , csv in between the column names should be displayed proper format in csv

I finally end writing my own _CSVtoDT with culture info and some formatting because… UiPath activities crash with huge data, weird characters and also change type when using GenericValue :smile:

I cant share my workflow but its something like

  1. read file
  2. split with Environment.Newline
  3. First used as header. for each item i add a column to a data table
  4. Rest used as raw data for each row i add a row.ItemArray

Yeah it works :slight_smile:

If you use linq and some string functions its easy and faster than excel.

the delimiter is an argument you use in the split and works with anything

1 Like