Csv read looping

i have 5 fanspages of fb and i have 100 files in csv to upload. i want to upload every fanpage 20 files. i use loop. but in the second fanspage, it upload from the first file, not 21st. how to make it continue uploading the rest of the files?
thank you

In the 2nd macro, use:

store | 21 | !csvReadLineNumber

@imacros0 i cant send the macro i made here (because i’m newbie here). the file in the csv always return to the first

To do this job you can use 2 !TIMES command

first !TIMES for the fanpage loop (from 1 to 5)
second !TIMES for upload csv (from 1 to 100)

In this mode you have 2 separated counter

Default loop is not the best choice

{
“Name”: “PL LOOP CHANNEL”,
“CreationDate”: “2023-4-10”,
“Commands”: [
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorIgnore”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “!TIMEOUT_WAIT”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “fast”,
“Value”: “!replayspeed”,
“Description”: “”
},
{
“Command”: “csvReadArray”,
“Target”: “sofasoccer.csv”,
“Value”: “jadwal”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${!csvReadMaxRow}”,
“Value”: “baris”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “x”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${x})”,
“Value”: “x”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “z”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${z})”,
“Value”: “z”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${z})+1”,
“Value”: “ch”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “https://www.youtube.com/channel_switcher”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “xpath=//ytd-account-item-renderer[${ch}]/tp-yt-paper-icon-item/div/yt-img-shadow/img”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “https://www.youtube.com/channel_switcher”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “csvReadArray”,
“Target”: “sofasoccer.csv”,
“Value”: “myArray”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${!csvReadMaxRow}”,
“Value”: “max”,
“Description”: “”
},
{
“Command”: “while_v2”,
“Target”: “${z}<30”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${ch})+1;”,
“Value”: “ch”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “3000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “xpath=//ytd-account-item-renderer[${ch}]/tp-yt-paper-icon-item/div/yt-img-shadow/img”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “gotoLabel // skipp”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//button/yt-img-shadow/img”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “xpath=//yt-multi-page-menu-section-renderer/div[2]/ytd-compact-link-renderer[2]/a/tp-yt-paper-item/div[2]/yt-formatted-string”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “2000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “open // https://studio.youtube.com/”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “waitForElementVisible // id=contentIcon”,
“Value”: “5000”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="menu-paper-icon-item-1"]/div[2]",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="menu-paper-icon-item-1"]/div[2]”,
“xpath=//li[2]/ytcp-ve/a/tp-yt-paper-icon-item/div[2]”,
“css=#menu-paper-icon-item-1 > div.nav-item-text.style-scope.ytcp-navigation-drawer”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="playlist-list-tab"]/div/ytcp-ve/span",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="playlist-list-tab"]/div/ytcp-ve/span”,
“xpath=//tp-yt-paper-tab[3]/div/ytcp-ve/span”,
“css=#playlist-list-tab > div > ytcp-ve > span”
],
“Description”: “”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “x”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “25”,
“Value”: “max”,
“Description”: “”
},
{
“Command”: “while_v2”,
“Target”: “${x}<${max}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “csvReadArray”,
“Target”: “plsofa.csv”,
“Value”: “myArray”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="create-icon"]/div",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="create-icon"]/div”,
“xpath=//header/div/ytcp-button/div”,
“css=#create-icon > div”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="text-item-2"]/ytcp-ve",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="text-item-2"]/ytcp-ve”,
“xpath=//tp-yt-paper-item[3]/ytcp-ve”,
“css=#text-item-2 > ytcp-ve”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="create-playlist-form"]/ytcp-form-textarea/div/textarea",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="create-playlist-form"]/ytcp-form-textarea/div/textarea”,
“xpath=//textarea”,
“css=#create-playlist-form > ytcp-form-textarea > div > textarea”
],
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${myArray[${x}][8]} ${myArray[${x}][3]}”,
“Value”: “kw”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${myArray[${x}][9]}”,
“Value”: “title”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${myArray[${x}][4]} Vs ${myArray[${x}][5]} Live Stream | ${myArray[${x}][8]}\n📅 Date: ${myArray[${x}][0]} ${myArray[${x}][1]}\n📺 Live Broadcast at ${myArray[${x}][16]}\nHow to Watch ${myArray[${x}][8]} between ${myArray[${x}][4]} Vs ${myArray[${x}][5]} online coverage.\n${myArray[${x}][4]} Vs ${myArray[${x}][5]} Live Stream\n${myArray[${x}][4]} Vs ${myArray[${x}][5]} Full Match\n${myArray[${x}][5]} Vs ${myArray[${x}][4]} Live Stream\n${myArray[${x}][5]} Vs ${myArray[${x}][4]} Full Match\n${myArray[${x}][5]} @ ${myArray[${x}][4]}\n${myArray[${x}][5]} @ ${myArray[${x}][4]}\n${myArray[${x}][6]} Vs ${myArray[${x}][7]}\n${myArray[${x}][7]} Vs ${myArray[${x}][6]}\n${myArray[${x}][7]} @ ${myArray[${x}][6]}\n\n${myArray[${x}][3]} Highlights\n${myArray[${x}][8]} Highlights\n${myArray[${x}][4]} live score, schedule and results\n${myArray[${x}][5]} live score, schedule and results\n\n#${myArray[${x}][6]}\n#${myArray[${x}][7]}\n#${myArray[${x}][9]}\nWatch ${myArray[${x}][4]} vs ${myArray[${x}][5]} Live”,
“Value”: “des”,
“Description”: “”
},
{
“Command”: “editContent”,
“Target”: “id=textbox”,
“Value”: “${title}”,
“Description”: “”
},
{
“Command”: “sendKeys”,
“Target”: “id=textbox”,
“Value”: “${title}”,
“Targets”: [
“xpath=//[@id="create-playlist-form"]/ytcp-form-textarea/div/textarea",
“xpath=//textarea”,
“css=#create-playlist-form > ytcp-form-textarea > div > textarea”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div/div[2]/div/ytcp-social-suggestion-input/div”,
“Value”: “”,
“Targets”: [
“id=textbox”,
"xpath=//
[@id="textbox"]”,
“xpath=//div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div/div[2]/div/ytcp-social-suggestion-input/div”,
“css=#textbox”
],
“Description”: “”
},
{
“Command”: “editContent”,
“Target”: “xpath=//div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div/div[2]/div/ytcp-social-suggestion-input/div”,
“Value”: “${des}”,
“Description”: “”
},
{
“Command”: “sendKeys”,
“Target”: “xpath=//div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div/div[2]/div/ytcp-social-suggestion-input/div”,
“Value”: “${des}”,
“Targets”: [
“id=textbox”,
“xpath=//[@id="textbox"]",
“xpath=//div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div/div[2]/div/ytcp-social-suggestion-input/div”,
“css=#textbox”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: "xpath=//
[@id="create-button"]/div”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="create-button"]/div",
“xpath=//div[2]/ytcp-button[2]/div”,
“css=#create-button > div”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “refresh”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=edit-button”,
“Value”: “”,
“Targets”: [
“id=edit-button”,
"xpath=//
[@id="edit-button"]”,
“xpath=//ytcp-icon-button[@id=‘edit-button’]”,
“xpath=//div/div/div[2]/a/ytcp-icon-button”,
“css=#edit-button”
],
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=1”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="button-shape"]/button/yt-touch-feedback-shape/div/div[2]",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="button-shape"]/button/yt-touch-feedback-shape/div/div[2]”,
“xpath=//ytd-menu-renderer/yt-button-shape/button/yt-touch-feedback-shape/div/div[2]”,
“css=#button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__fill”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="items"]/ytd-menu-service-item-renderer/tp-yt-paper-item/yt-formatted-string",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="items"]/ytd-menu-service-item-renderer/tp-yt-paper-item/yt-formatted-string”,
“xpath=//ytd-menu-service-item-renderer/tp-yt-paper-item/yt-formatted-string”,
“css=#items > ytd-menu-service-item-renderer.style-scope.ytd-menu-popup-renderer.iron-selected > tp-yt-paper-item > yt-formatted-string”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “selectFrame”,
“Target”: “xpath=/html[1]/body[1]/div[2]/div[2]/div[1]/iframe[1]”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “xpath=//[@id="yDmH0d"]/div[2]/div[2]/div/div/div[3]/div/div/div[2]/div[1]/input[2]",
“Value”: “${myArray[${x}][8]} ${myArray[${x}][3]}”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “css=#yDmH0d > div.Q6HCU.IzuY1c.yxmr8b > div:nth-child(2) > div > div > div.lYHz5e > div > div > div.nh8htf > div > svg”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="yDmH0d"]/div[2]/div[2]/div/div/div[3]/div/div/div/div/svg”,
“css=#yDmH0d > div.Q6HCU.IzuY1c.yxmr8b > div:nth-child(2) > div > div > div.lYHz5e > div > div > div.nh8htf > div > svg”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “200”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “fast”,
“Value”: “!replayspeed”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[1]/div/div[2]/div/img”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[2]/div/div[2]/div/img”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[3]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op6ssy3MNFxQlk"]/div/img",
“xpath=//div[3]/div/div[2]/div/img”,
“css=#op6ssy3MNFxQlk > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[4]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op6tRpNsWxKdak"]/div/img”,
“xpath=//div[4]/div/div[2]/div/img”,
“css=#op6tRpNsWxKdak > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[5]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[6]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op69Yg6dCyUI_M"]/div/img”,
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[7]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[8]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op69Yg6dCyUI_M"]/div/img”,
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[9]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[10]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op69Yg6dCyUI_M"]/div/img”,
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[11]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[12]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op69Yg6dCyUI_M"]/div/img”,
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[13]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[14]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op69Yg6dCyUI_M"]/div/img”,
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[15]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[16]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
"xpath=//
[@id="op69Yg6dCyUI_M"]/div/img”,
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//div[17]/div/div[2]/div/img”,
“Value”: “”,
“Targets”: [
“xpath=//[@id="op69Yg6dCyUI_M"]/div/img",
“xpath=//div[5]/div/div[2]/div/img”,
“css=#op69Yg6dCyUI_M > div.nHAUqf > img”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: "xpath=//
[@id="yDmH0d"]/div[2]/div[5]/div/div[3]/button/span”,
“Value”: “”,
“Targets”: [
“xpath=//*[@id="yDmH0d"]/div[2]/div[5]/div/div[3]/button/span”,
“xpath=//button/span”,
“css=#yDmH0d > div.Q6HCU.IzuY1c.yxmr8b > div.aw9Lfe > div > div.HUStxf > button > span”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “3000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “TAB=0”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “TAB=CLOSEALLOTHER”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${x})+1;”,
“Value”: “x”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “https://www.youtube.com/channel_switcher”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${z})+1”,
“Value”: “z”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “if_v2”,
“Target”: “${x}>=${baris}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “x”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//button/yt-img-shadow/img”,
“Value”: “”,
“Description”: “”
}
]
}

@newuserkantu i make that macro. its run for the channel. but in the second channel. the file in csv return to the first. i have 250 date in the csv.

The macro code is too long and confusing, a few lines of code are enough to load some csv files, when a macro code is too long it becomes difficult to find errors and correct them. I recommend that you rewrite the code in a simpler way to be faster and easier to fix.