How to bulk update non-consecutive rows in Google Sheets using the batch update api

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

Welcome to the Make community!

Try using a Search Rows module, and then Array Aggregate the replacements, followed by the Bulk Update Rows module.

You have not yet provided sufficient information to demonstrate the problem that would allow us to reproduce the scenario and any error(s).

If you need further assistance, please provide the following:

1. Relevant Screenshots

Could you please share screenshots of your full scenario? Also include screenshots of any error messages, module settings (fields), relevant filter settings (conditions), and module output bundles. We need to see what you’re working with to give you the best advice.

You can upload images here using the Upload icon in the text editor:

We would appreciate it if you could upload screenshots here instead of linking to them outside of the forum. This allows us to zoom in on the image when clicked, and prevent tracking cookies from third-party websites.

2. Scenario Blueprint

Please export the scenario blueprint. Providing your scenario blueprint file will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return - this would greatly benefit you in implementing our suggestions as you can simply paste module exports back into your scenario editor!

To export your scenario blueprint, click the three dots at the bottom of the editor then choose ‘Export Blueprint’.

You can upload the file here by clicking on this button:

3. Output Bundles of Modules

Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).

Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.

A. Upload as a Text File

Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.

You can upload the file here by clicking on this button:

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved, and help you with mapping the raw property names from collections.

Sharing these details will make it easier for others to assist you.

Hi,

I’ve attached all now, thank you. So in short, i’m trying to go from uploading the apify actor output 1 by 1 to updating the rows in bulk



Apify Web Scrape Output Bundles.txt (2.2 MB)
Module 44 Output Bundles (only 3 bundles).txt (1.2 KB)
Sheets Module 45 Output Bundles (Only 3 Bundles).txt (6.6 KB)
blueprint (6).json (114.9 KB)