Hi,
I’ve read a few other posts on this topic but I haven’t got an answer for my specific problem.
I’m using apify to scrape leads, I bulk add rows to an initial google sheet where I store my lead list.
I then use fields from here, such as website url and linkedin url to feed into other scrapers to then scrape more information about my lead. Each scrape is a seperate route in my scenario.
After I get the dataset item from apify of the scraped data (website/linkedin scrape) how do I bulk update these rows to the matching lead in my initial lead list. I would like to identify the original lead using either the website url or linkedin url, so I can get the row number but how do I then put that into an array that I can feed into the google sheets batchupdate api call.
This is how the batch update api call JSON payload will look like for each update request, which I understand and I am fine with:
{
“requests”: [
{
“updateCells”: {
“range”: {
“sheetId”: 0,
“startRowIndex”: 5,
“endRowIndex”: 6,
“startColumnIndex”: 3,
“endColumnIndex”: 4
},
“rows”: [
{
“values”: [
{ “userEnteredValue”: { “stringValue”: “Welcome to Company A” } }
]
}
],
“fields”: “userEnteredValue”
}
},
{
“updateCells”: {
“range”: {
“sheetId”: 0,
“startRowIndex”: 9,
“endRowIndex”: 10,
“startColumnIndex”: 3,
“endColumnIndex”: 4
},
“rows”: [
{
“values”: [
{ “userEnteredValue”: { “stringValue”: “Official Site of Brand B” } }
]
}
],
“fields”: “userEnteredValue”
}
},
{
“updateCells”: {
“range”: {
“sheetId”: 0,
“startRowIndex”: 14,
“endRowIndex”: 15,
“startColumnIndex”: 3,
“endColumnIndex”: 4
},
“rows”: [
{
“values”: [
{ “userEnteredValue”: { “stringValue”: “Experience Excellence” } }
]
}
],
“fields”: “userEnteredValue”
}
}
]
}
The part I am struggling with is, how do I map the data from 2 different outputs. i.e; If this website url (apify output) matches this website url (search rows of google sheet) then I need this websiteScrape Value (apify output) updated to the matching row number of the google sheet. If I can map that out successfully in a text aggregator, that I can feed into the google sheets api payload, then I might get some of my hair back that I’ve been pulling out for the past 6 hours!
Any help is Appreciated! Thank You