Skip Header reading CSV file - VisualCron - Forum

Community forum

I am downloading a csv file and then looping through the file to insert data into SQL. This is working fine except the CSV file has a header and I need to skip row 1. How do I do this? I'm using the Loop For each row x in {TASK(PrevTask,StdOut)}
We will soon add some more Variables functions to extract specific lines.

Meanwhile I think it is safest to use the .NET code Task to extract the data. You could also combine a couple of Variable functions to remove the first line from the full data but I would recommend using the .NET code Task instead.
Please like  VisualCron on facebook!
Librus Prime
Is there an example of the dotnet code suggested above ?
Hi Librus,

If .net is a big questionmark for you, what you also can do is adding a job variable which is a counter (integer).
When you start the job, use a task to set this to: 0.
Then in the 1st task of the loop add a task to add 1 to this counter.
The sql statement task should have a condition to it. It checks if the value of job variable counter is equal to 1. If so, skip this task, else continue.

The next time in the loop, the counter gets a +1 again and equals to 2.
The condition on the sql task checks again the variable to value 1, which it isn't and the sql statement task is alowed.

This should do the trick, but .net ls a nice language to learn. You can do a lot with it, you can even make VisualCron ;-)

Uses Visualcron since 2006.
One other way to do this is to remove the headers using a simple Powershell task

(Get-Content $file | Select-Object -Skip 1) | Set-Content $file

Scroll to Top