Reading CSV from line 3

Hello,
I’m new to Kantu, coming from iMacros.
I need to read from CSV starting from line 3.

this is the code I’m using

“Commands”: [
{
“Command”: “csvRead”,
“Target”: “new.csv”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “3”,
“Value”: “!csvReadLineNumber”
},
{
“Command”: “type”,
“Target”: “id=fcogn1”,
“Value”: “${!COL2}”
},

When I run the macro it always reads from line one, no matter what value is stored in !csvReadLineNumber.
See attached screenshot.

Thank you for your help

Your macro is almost correct. But store | 3 | !csvReadLineNumber has to be before csvRead :wink:

1 Like

Thank you very much. it’s working now!

This was very helpful but how can I pick different values at every macro loop.
i.e when I run my macro…1st loop: Mike, 2nd loop: James, 3rd loop: Paul, then next loop starts from Mike.

The code below works to only pick Paul who is the 3rd row at every loop.

{
“Command”: “store”,
“Target”: “1”,
“Value”: “!csvReadLineNumber”
},
{
“Command”: “csvRead”,
“Target”: “readcssdata.csv”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “name=repsponsible”,
“Value”: “${!COL1}”
}

Use !loop - it contains the number of the current loop:

store | ${!loop} | !csvReadLineNumber

Thanks I am good now… I feel almost like a programmer :smile:

Hi ulrich thanks I tried to follow codes but it stopped auto fill comment ,

I got error with type name=repsponsible ${!COL1}”

any suggestions plz ?!!

{
“Name”: "comment ",
“CreationDate”: “2020-8-10”,
“Commands”: [
{
“Command”: “store”,
“Target”: “{!loop}", "Value": "!csvReadLineNumber" }, { "Command": "csvRead", "Target": "comment.csv", "Value": "" }, { "Command": "bringBrowserToForeground", "Target": "", "Value": "" }, { "Command": "XType", "Target": "{KEY_PGDN}”,
“Value”: “”
},

{
  "Command": "pause",
  "Target": "5000",
  "Value": ""
},

{
  "Command": "waitForPageToLoad",
  "Target": "10000",
  "Value": ""
},
{
  "Command": "times",
  "Target": "500000",
  "Value": ""
},
{
  "Command": "click",
  "Target": "xpath=(//*[@id=\"video-title\"]/yt-formatted-string)[${!TIMES}]",
  "Value": ""
},
{
  "Command": "waitForPageToLoad",
  "Target": "3000",
  "Value": ""
},
{
  "Command": "click",
  "Target": "xpath=//ytd-toggle-button-renderer/a/yt-icon-button/button/yt-icon",
  "Value": "",
  "Targets": [
    "xpath=//*[@id=\"button\"]/yt-icon",
    "xpath=//ytd-toggle-button-renderer/a/yt-icon-button/button/yt-icon",
    "css=#button > yt-icon"
  ]
},
{
  "Command": "XType",
  "Target": "${KEY_PGDN}",
  "Value": ""
},
{
  "Command": "click",
  "Target": "id=placeholder-area",
  "Value": "",
  "Targets": [
    "id=placeholder-area",
    "xpath=//*[@id=\"placeholder-area\"]",
    "xpath=//div[@id='placeholder-area']",
    "xpath=//ytd-comment-simplebox-renderer/div",
    "css=#placeholder-area"
  ]
},
{
  "Command": "type",
  "Target": "name=repsponsible",
  "Value": "${!COL1}”"
},
{
  "Command": "click",
  "Target": "xpath=//ytd-button-renderer[2]/a/paper-button/yt-formatted-string",
  "Value": "",
  "Targets": [
    "id=text",
    "xpath=//*[@id=\"text\"]",
    "xpath=//ytd-button-renderer[2]/a/paper-button/yt-formatted-string",
    "css=#text"
  ]
},
{
  "Command": "pause",
  "Target": "5000",
  "Value": ""
},
{
  "Command": "echo",
  "Target": "Loop Number ${!TIMES} Completed",
  "Value": "#shownotification"
},
{
  "Command": "end",
  "Target": "",
  "Value": ""
},
{
  "Command": "echo",
  "Target": "Macro Finished",
  "Value": "#shownotification"
}

]
}

Search this:

{
  "Command": "type",
  "Target": "name=repsponsible",
  "Value": "${!COL1}”"
},

Replace with this

{
  "Command": "type",
  "Target": "name=repsponsible",
  "Value": "${!COL1}"
},

there is no change !!

image

In your code posted in forum seems the is this error read your macro code posted in forum

I removed but same result

Can you please upload a small text macro that we can run here? Please use the “Export as ZIP” function, so that the CSV file is included with the macro as well.

HI , thanks please check dm.zip (15.8 KB)

I seen the zip file comment must be in format CSV and NOT xlsx and must saved in ui vision folder datasources or in html5 storage.

In this mode your macro can not work.

In macro you use this

{
  "Command": "csvRead",
  "Target": "comment.csv",
  "Value": ""
},

But you have not a csv file

Other error in macro code

{
  "Command": "type",
  "Target": "name=repsponsible",
  "Value": "COL1"
},

Your code have more errors, please rewrite it in correct mode.reading docs otherwise you lost only times for nothing

https://ui.vision/rpa/docs

dm.zip (8.3 KB)
obviously no problem in xlsx u even cannot import xlsx to macro I just wrong mixed files when uploading

{
“Command”: “type”,
“Target”: “name=repsponsible”,
“Value”: “COL1”
},

this why posting here and you always copy past this answer
Your code have more errors, please rewrite it in correct mode.reading docs otherwise you lost only times for nothing
https://ui.vision/rpa/docs

I already tell I need correct comand for this and you tell the same !!!

if you don’t know the correct answer or have valuble answer please just skip the post !!

I see that you write macros with many errors so I advised you to read the documentation to write correct macros, I can not correct a macro code with many errors you do before you rewrite it again.

If you read my fedbacks in the forum you will notice that I am very experienced and I have all the knowledge to make a high-level macro that works perfectly, it is very simple to make a self-posting like the one you are trying to accomplish but if you do not read the documentation and make gross mistakes it is normal that it will never work.

This is an error in your macro code

error

This is a correct command to use COL command (readed in docs)

|type |id=firstname |${!COL1}|

|type |id=lastname |${!COL2}|

how to readcsv start line 2 and end line 5?

You notice a down Arrow button in the top right corner? Then hover the mouse on that, choose loop, then choose start 2 and end 5.

i mean readcsv using while or readcsv based on command prompt