For each row in a .csv activity doesn't terminates at even the data row finished


#1

I am using read csv and for each row activity. but the execution of for each activity doesn’t terminated even data row completed.


#2

Hi @rahul_bansal,

Are u using the as below steps.

  1. Read the csv file into Datatable
    2.Do the loop with For each row loop as below one

image

Regards
Balamurugan.S


#3

yes I am following the same step. But the execution doesn’t terminate when there is no more data row in .csv file.


#4

Can you share the xaml with csv. If you feel it is confidential, send by message.

Regards
Balamurugan


#5

Hi @rahul_bansal

It is a long shot, but I’ll try to suggest a possible culprit. This seems like an issue with your read range activity. Do you happen to read your range into a Data Table by using two quotes: "" ?

If yes, Excel will sometimes read more than needed, including some empty rows that he treats as part of the data set. I only encountered it so far in actual Excel files and not CSV, but it is something you can check for.

If the above is true, try to read a newly created test CSV file with a few test rows.


#6

sorry It is confidential can’t share. Please help.


#7

I am using read csv with delimiter as comma.


#8

Sorry for lengthy non-solution, I didn’t realize CSV activity does not allow you to specify range.

Could you maybe make an example csv file with no confidential data and share it with us?
Preferable with a sample of your xaml solution.


#9

What I was doing is manually(opening a .xlsx file the save as .csv and using this file for read csv activity).


#10

share.zip (7.6 KB)

for example I have new excel in this zip.

1 I open the workbook.
2. go to sheet3.
3. go to file option.
4. go to save as.
5 named it as share and type as .csv delimiter.
6. and use share.csv which is created using above step in Read CSV Activity.


#11

Thank you for more context.

See attached workflow for a working solution. I simplified it a bit:
SavingAsCSV.zip (9.1 KB)

It does generate your desired output, I hope it helps you figure out what the original issue is.


#12
Scheduled Start Date Scheduled Start Time Scheduled End Date Scheduled End Time
7/26/2018 7:33 AM 7/26/2018 9:27 AM
7/27/2018 10:54 PM 7/27/2018 11:02 PM

Above provided data table entries is in .xlsx file and when i use write csv as you provided then it changes the data to below provided table entries

Scheduled Start Date Scheduled Start Time Scheduled End Date Scheduled End Time
7/26/2018 0:00 12/30/1899 07:33:00 7/26/2018 0:00 12/30/1899 09:27:00
7/27/2018 0:00 12/30/1899 22:54:00 7/27/2018 0:00 12/30/1899 23:02:00

#13

I think this happens because Read Range activity is automatically assigning a DateTime type to the variables and then everything is based on that.
You can parse the dates after fetching them from the initial Excel file and all is good.

See attached workflow for the solution:
ResaveDataAndParseDate.zip (9.7 KB)

If the format of your dates changes, you can refer to this documentations on how to modify the parsing string:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings


#14

Thank you.:blush:
Great help. You did it exactly what i want.:heart_eyes: