Add Row to Google Sheets at Given Row #

I’m trying to populate a Google Sheets invoice from a JSON webhook trigger. Make.com would check each JSON variable, and, if true, add a row for it in the invoice. I’m encountering two problems:

(1) Make.com always adds a new row to the top of the Sheet, but the invoice line-items start at line 11. Is it possible to select where you want to add the row?

(2) Anytime Make.com encounters a failed if/then condition in the filter, it stops the entire flow. However, even if one invoice item is not true, I need it to continue to the next.

Any help is greatly appreciated.

Hello @David_King,

One thing you could try for item #1 is to add a Google Sheets Make an API Call module configured like this:

In the URL, replace that long string with your Spreadsheet ID.
Also, in the Body, replace sheetID with the index of the sheet starting with 0 referring to the first sheet.

This will insert one row at row 11 and move everything below that down a row. Also, the new row will inherit the formatting from the row above it.

If that module is successful, row 11 should be empty and ready to use Google Sheets Update a Row module on Row 11.

As for Item #2, can we see what this part of your scenario looks like?
The scenario should really only stop if it encounters an unexpected error or you put in an error handler.

Hope that helps.

2 Likes

Where do you add the actual data for “Value for A7”, “Value for B7”, “Value for C7” ?

Using “Make an API Call” as I described, that will insert a row at a specific row.
Then, you can use “Google Sheets Update a Row” to update data in the inserted row.

2 Likes

Here is the code:

{
    "requests": [{
                "insertDimension": {
                    "range": {
                        "sheetid": 0,
                        "dimension": "ROWS",
                        "startindex": 10,
                        "endIndex": 11 |
                            "inheritFromBefore": true
                    }
                }
            }

Error:

400: INVALID_ARGUMENT - Invalid JSON payload received. Unknown name "sheetid" at 'requests[0].insert_dimension.range': Cannot find field. Invalid JSON payload received. Unknown name "startindex" at 'requests[0].insert_dimension.range': Cannot find field.

put a comma after then endindex,

“endindex” : 11,

2 Likes

Sorry I should have copied and pasted the text itself instead of a screenshot.

Remove the pipe after “endIndex”: 11
Also, inherentFromBefore goes outside the range object.

2 Likes

Can you please paste the proper code?

Code:

{
    "requests": [{
                "insertDimension": {
                    "range": {
                        "sheetid": 0,
                        "dimension": "ROWS",
                        "startindex": 7,
                        "endIndex": 11,
                    }
                            "inheritFromBefore": true
                }
            }

Error:

The operation failed with an error. 400: INVALID_ARGUMENT - Invalid JSON payload received. Expected , or } after key:value pair. “inheritFromBefore”: ^

Use this,


{
    "requests": [
        {
            "insertDimension": {
                "range": {
                    "sheetid": 0,
                    "dimension": "ROWS",
                    "startindex": 7,
                    "endIndex": 11
                },
                "inheritFromBefore": true
            }
        }
    ]
}
2 Likes

I am trying to feed data from AirTable into Google Sheets so that Make inserts as many rows as needed (based on data pulled from AirTable).

What is the proepr way/sript to insert multiple rows rather than one?

I need the rows to be inserted starting at row 7 and then going down for as long as needed.

Using your code, I got an error:

00: INVALID_ARGUMENT - Invalid JSON payload received. Unknown name “sheetid” at ‘requests[0].insert_dimension.range’: Cannot find field. Invalid JSON payload received. Unknown name “startindex” at ‘requests[0].insert_dimension.range’: Cannot find field.

You are using wrong keys, Just try with this now, you can just copy paste and see if it works,

{
    "requests": [
        {
            "insertDimension": {
                "range": {
                    "sheetId": 0,
                    "dimension": "ROWS",
                    "startIndex": 7,
                    "endIndex": 11
                },
                "inheritFromBefore": true
            }
        }
    ]
}
2 Likes

Thank you. It looks like it sowking without an error now. However, I still can’t figure out the solution to my problem.

I am trying to feed data from AirTable into Google Sheets so that Make inserts as many rows as needed (based on data pulled from AirTable).

What is the proepr way/sript to insert multiple rows rather than one?

I need the rows to be inserted starting at row 7 and then going down for as long as needed.

Will it be always 7 i.e the starting row?

1 Like

Row 6. I need to insert these variables (values) from AirTable:

Date of service Clinic Service Patient’s Last Name, First Name