Write Data Table to Excel sometimes doesn't write the First Letters

Hello,

I was following an advice of Yoichi in this topic. “Getting an error while reading csv "Line 2 contains more values than the header line". Moreover it is getting opened up manually without any issue

i had the same problem and tried to solve it by following his steps. It was actually successful but at some rows it doesnt write the first letter. I think Read Text File fails somewhere that i dont know of.
example line in the csv.
image
example line in xlsx.
image
the flow i build.

Hi @aayc

Test the date in generate datatable activity by changing properties, by passing some data.

Hi @aayc

Check the below thread

Hope it helps!!

Hi @aayc

Can you send the sample excel with input sheet and the expected output sheet too

Regards

Hi there,

i tested it a bit. When i pick the csv parsing on some rows the generated data table doesnt include first letter of that row. on the other hand when i pick custom seperation it does write all the letters as expected but then the newline seperator with newline doesnt work properly. Read Text File activity reads the csv documents i have properly. i am generating a data table from that output and writing that data table to excel. however sometimes the letters are missing but its not an encoding problem tho

Make sure there are no extra characters or delimiters at the beginning of each row in the CSV file.
Double-check the delimiter used in the CSV file (e.g., comma, semicolon) and make sure it matches the settings in UiPath.

Try this for new line seperater if you are using windows:
\r\n

Try this for new line seperater if you are using linux:
\n

@aayc

how do i use “\r\n” ? i am using studiox btw.

@aayc

In place of new line separater in generate datatable activity.
image

well it didnt work for me when i try custom seperator. i switched back to csv parsing.

the csv it reads look like this

image

the output with generate data table → write data table activity looks like this.

image

i have no idea where did that “H” go. on the 39th line. and its same with other some other lines as well the first letter disappears for some reason

i am trying to combine csv documents in one excel and use for each excel row activity to work/match with some keywords on each row.

@Yoichi i was following an advice of yours. do you have any idea why the output is missing first letters of some rows ?

@aayc

Is it possible to give a sample csv here please

Also can you please print the data and check how you are getting newline character is it \n or \r\n or \r or anything else…for this use log message and write the data of string and open log message and click on info icon beside it or double click log wich shows how the data sepration looks

Cheers

uploaded the first 50 rows of it below. I couldnt find a way how to use log message

1.7z (1.9 KB)

Hi,

I just checked your data. However, I couldn’t reproduce your matter in my environment.
Can you check the following sample?

Sample20230731-2aL.zip (13.4 KB)

Regards,

i couldnt open the project on studiox.

HI,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(strData,"\r(?!\n)",vbCrLf)

image

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.