Create a google sheet file add the content line by line and column by column

Good morning,

I already opened a topic here,

but I prefer to open a new topic to better focus on the problem.

My goal is to create a scenario, for summary →

  1. Create a Google Sheet file
  2. Make a request with Open AI
  3. Fill out the Google sheet
  4. Send by email

This whole process works well.

I managed to add the values line by line with the help of @samliew

with this code →

Capture d’écran 2024-01-19 à 14.45.45

in the iterator module.

I can now have my data line by line.

What I want now is to add their value column by column.

In my prompt I ask this

I receive the Google sheet by email with this result →

Capture d’écran 2024-01-19 à 14.54.20

I have the information line by line
but I also want to replace the - adding the second column

Capture d’écran 2024-01-19 à 14.57.17
Note: manual action on my part on the googlesheet

My question is, is it possible with the Iterator module to create values row by row and column by column?

Here are my outputs:

Open AI module

[
    {
        "id": "msg_MyXXXXXXMduDoNXXX",
        "object": "thread.message",
        "created_at": "2024-01-19T13:52:47.000Z",
        "thread_id": "thread_XXXXxyyXX",
        "role": "assistant",
        "content": [
            {
                "type": "text",
                "text": {
                    "value": "NOM-COULEUR-PAYS\nRenaurd-Brun-Belgium\nMouse-Gris-France\nLion-Brun-Kenya\nTigre-Orange-Inde\nGirafe-Jaune-Tanzanie",
                    "annotations": []
                }
            }
        ],
        "file_ids": [],
        "assistant_id": "asst_GH4KXXXXXPrGlUM8",
        "run_id": "run_YemXXXXXX8XXX1ha",
        "metadata": {}
    }
]

Iterator module

    {
        "value": "NOM-COULEUR-PAYS",
        "__IMTINDEX__": 1,
        "__IMTLENGTH__": 6
    },
    {
        "value": "Renaurd-Brun-Belgium",
        "__IMTINDEX__": 2,
        "__IMTLENGTH__": 6
    },
    {
        "value": "Mouse-Gris-France",
        "__IMTINDEX__": 3,
        "__IMTLENGTH__": 6
    },
    {
        "value": "Lion-Brun-Kenya",
        "__IMTINDEX__": 4,
        "__IMTLENGTH__": 6
    },
    {
        "value": "Tigre-Orange-Inde",
        "__IMTINDEX__": 5,
        "__IMTLENGTH__": 6
    },
    {
        "value": "Girafe-Jaune-Tanzanie",
        "__IMTINDEX__": 6,
        "__IMTLENGTH__": 6
    }
]


Google sheet add module

[
    {
        "spreadsheetId": "1Nq7DDVx714hfA5fqzDE0v8ZMRb7l2hjNYBVEUtsTZLE",
        "updates": {
            "spreadsheetId": "1Nq7DDVx714hfA5fqzDE0v8ZMRb7l2hjNYBVEUtsTZLE",
            "updatedRange": "'Feuille 1'!A1",
            "updatedRows": 1,
            "updatedColumns": 1,
            "updatedCells": 1
        },
        "sheetName": "Feuille 1",
        "rowNumber": 1
    }
]

I tried to document as much as possible :slight_smile:
hoping to have an answer, if you need other information I remain available

Thanks

Hello Rejoo,

I created a simple string “one-two-three” in a parse JSON module for demonstration.

image

Then, I set a variable named “Array” to the value {{split(20.data; “-”)}}.

This takes the string “one-two-three”, and returns an the array [“one”,“two”,“three”].

image

You can use this array to fill out your google sheet rows without needing to make any manual adjustments.

Hope this helps!

4 Likes

Thank you so much @IOA_Brett
your solution helped me a lot and it works.

I’ll share with you a picture of what it looks like :slight_smile:

Capture d’écran 2024-01-19 à 22.28.52

Capture d’écran 2024-01-19 à 22.29.00

thanks :slight_smile:

2 Likes