Open Ai Transform Response module to Google Sheet Add new row module

Hello everyone,

I am struggling to get the desired output format for Open AIs ‘transform’ module to google sheet’s ‘add row’ module.

For context, the ideal scenario (pun intended) is that when I input an unstructured meal plan in the Open AI module, it gives a structured response, and each response is added as a new row in a google sheet.

When I first did this, only one row of data appeared. (row 2 in the spreadsheet screenshot).

I did some research and it said I could try using array, but that meant all the items in each column were in one cell separated by commas (row 3 of spreadsheet).

There are no errors, but I would love some help to correct it (I have manually written out the desired row result in rows 9-16 of the screenshot). I know I need some more modules, please let me know which ones - thanks!

try asking GPT to generate the information in JSON then use a parse json module and use an iterator to create new rows.
this may be a simplistic response, but I have done a similar scenario with that approach and it worked.

2 Likes

Thank you, unfortunately its not working - the json is being parsed into bundles but the iterator is showing the bundles as empty.



I am also not sure what data would be plugged into the google sheet table fields
Please let me know if I’m missing something or if you have any screenshots of what worked for you that might help. Thanks!

Welcome to the Make community!

If you are using Rafael_Sanchez’s suggestion, they are already in bundles, and not an array; you don’t need an iterator.

3 Likes

Thank you. This works when I use the open ai create a completion module and ask for the output as a json. However the Open AI module outputs are far better when I use the Transform to Data module. Please are you able to help me convert the outputs into something usable?

This is how the Transform to Data module outputs the information (1 bundle with an array for each parameter, each one with 9 children. However, I’d want to convert this to 9 bundles which have meal, day, prep time and notes as children)

PLEASE do you know how to do this?

Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

2 Likes

Sure! When i tried to upload .txt files I got an error.

But anyways here is the output bundle with the backticks:

[
    {
        "meal": [
            "oats",
            "teryaki chicken and rice",
            "apple",
            "salmon and peas",
            "vegetarian",
            "pancake and mixed berries",
            "brown rice and turkey slices",
            "macaroni cheese",
            "muesli",
            "quinoa with curry tofu",
            "penne arrabiata",
            "very tasty"
        ],
        "Day": [
            "Day 1",
            "Day 1",
            "Day 1",
            "Day 1",
            "Day 1",
            "Day 2",
            "Day 2",
            "Day 2",
            "Day 3",
            "Day 3",
            "Day 3",
            "Day 3"
        ],
        "Prep_time": [
            "30 mins",
            "30 mins",
            "20 min",
            "-",
            "-",
            "1 hr",
            "-",
            "-",
            "-",
            "-",
            "-",
            "-"
        ],
        "Notes": [
            "-",
            "-",
            "-",
            "-",
            "-",
            "-",
            "longer preparation time but worth it",
            "-",
            "-",
            "-",
            "very tasty",
            "-"
        ]
    }
]

I’ll put below the screenshot again of how I’d want new rows to be added to a google sheet with this output. Thanks!