How do i read unique value from csv file and pass in http call

Hi,

i need to pass unique login credentials to a http get call, I am using csv files to store data. how do i read them as they are in two different field

Value should be unique for each of the VUs. Can someone help here! .Thanks in advance.

few lines from csv
#Username,Password
perf10983943892@example.com,Perf@322
perf11085134393@example.com,Perf@323
perf11572463465@example.com,Perf@325
perf11689899399@example.com,Perf@329
perf11649833343@example.com,Perf@333
perf11656115595@example.com,Perf@395
perf11021979225@example.com,Perf@225

import { sleep, group, check } from “k6”;
import exec from “k6/execution”;
import http from “k6/http”;
import papaparse from ‘https://jslib.k6.io/papaparse/5.1.1/index.js’;
import { SharedArray } from ‘k6/data’;

const logindata = new SharedArray(‘login’, function () {
return papaparse.parse(open(‘./LoginDetails.csv’)).logindata;
});

export default function main() {

var username = logindata[exec.scenario.iterationInTest];
var password = logindata[exec.scenario.iterationInTest];
console.log(““,username);
console.log(”
”,password);

let response;

group(“Home - Home”, function () {
// Trx_01_Home
response = http.get(
http://55.620.56.782/index.html”,
{
headers: {
“upgrade-insecure-requests”: “1”,
},
});
const SessionID = findBetween(JSON.stringify(response), ‘userSession value=’, ‘>’);
console.log(“>>>>>>>>>>>”,SessionID);
sleep(6.1);
});

group(
“Login - Login”,
function () {
// Trx_02_Login
response = http.get(
// http.urlhttp://55.620.56.782/pti/credential?userSession=${SessionID}&username=${username}&password=${password}&JSFormSubmit=off,
{
headers: {
“upgrade-insecure-requests”: “1”,
},
});
sleep(6.1);
}
);

Hello. This link could help you. I think is the same way you need.