Multiple GPT Requests To Single G-Sheet Row

Hi Team,

We need help creating a piece to add multiple gpt prompt/responses to 1 x g-sheet row.

Trigger: new row on g-sheet.

Action: we want to make multiple gpt requests (prompts/queries) and have the responses added to different columns within the same row.

UserCase: new column with new brand is added, say Nike, we have , we have 3 x core prompts.

Prompt1: About Us content to be generated about the brand and added to About Us column in the same row.

Prompt2: Short Description content to be generated about the brand and added Short Description column in the same row.

Prompt3: Features content to be generated about the brand and added to the feature-title[1], feature-text[1], and then same for feature 2,3,4,5, columns on the same row.

We need direction on how to structure this piece please.

We have no issue right now creating the trigger and generating the 1st prompt, but struggling on how to add that content back into the same row, or repeating this for the other prompts.

Look forward to your response,

Hi @mr-oodler,

I was a little unclear exactly what you were after with the Prompt 3 part. However, I have tried to demonstrate what I think it is that you are trying to do. It could be way off.

Okay, so here is a sheet example I created; I took two products from Amazon to use as an example.

Things To Note:

  • Look at the Header/Title Row of each column; these are important to note for some of our steps as these are what we will target for our actions.
  • I have only added two rows for the example, but you could easily add 100, and it would do the same, but remember it will only poll 10 each run. You can see we have added a URL (which isn’t needed in this example, but it was just for me to keep track of the product used). Mainly, we are interested in the Product Title here.

This next part shows how the sheet columns correspond to the Trigger (for testing our sample data) and, mainly, the Update Row.

As you can see, we can verify all of our columns do exist, great!

But before we can output, we must go back a few steps to create our actions in between, which will be for asking Chat GPT to do something.

Here is what my prompts are doing:

  • Step 2: - This asks Chat GPT to create an SEO-friendly Meta Title based on the 1. New Row values B (which in our case is the Product Title we set in the sheet).
  • Step 3: - This asks Chat GPT to create an SEO-friendly URL slug based on the 1. New Row values B (which, again, is our Product Title).
  • Step 4: - This asks Chat GPT to create an SEO-friendly Meta Description on the 1. New Row values B (which uses our Product Title).
  • Step 5: - This asks Chat GPT to create an SEO-friendly Excerpt on the 1. New Row values B (which, you guessed it, uses our Product Title).

Note: For this simple example, I just used to product title for every prompt. In your case, you could feed the results from each Chat GPT prompt into the next Chat GPT prompt to use instead. You would enter it similar to how you enter New Row values B, except you would click a prior Chat GPT step and input the result from that instead, which the next Chat GPT step would use as context.

Finally, we are up to the Update Row action. Below, you can see that we set the result from each Chat GPT action to the relevant row for each of the columns.

Then, we run our Task after publishing it. We can then see that it has run multiple requests and created data for multiple product data simultaneously.

(But remember, as stated, it will only poll 10 on each run. Sometimes, Chat GPT requests can time out or fail. If this happens, then you can go to Runs to see the failed ones, and by clicking on them, it will take you into the flow, where you can click through the steps to see which ones failed. Then, to get your task to try to create these again, just repaste them as new rows under all of the completed rows).

Hopefully, this helps or at least points you in the right direction. As I said, I was a little confused with your third step.

Kind Regards

1 Like

Hi @JunnerJnr,

HUGE thanks for that attempt to help, it WAS a big help.

You actually fully understand what we are trying to achieve, ie create content based on a prompt, you used Product Title, we are using Brand Name, same/same.

Issue 1 - see image below.
Q: What Row Number must I add here for Update Row? I mean it should just update the row number that the Brand-Name row its pulling data from.
EG if we add a new row and run this, it will update each new row.

Issue 2 - see image below.
In our report, other than About-Brand, we are looking to ask gpt to create 5 x product titles and associated descriptions and populate the 5 x title fields and 5 x description fields with the response.
I understand from your breakdown that I could add 5 x GPT steps to create the 5 x titles, then 5 x GPT steps to create the 5 x descriptions.
Assuming there is a way for the 2nd, 3rd, 4th, 5th title requests can reference the last request and ensure its different.
However… I am hoping to make this easier with 1 x query.
EG I can make a GPT query to make 5 x titles with 5 x description responses and have them seperated in the response, which it does, but when I get to Update Row, there is no way to separate the response to each field.
I tried asking the prompt to separate the responses into json format, but it didnt. (having no idea if that would help)
Do u have any method to get 1 response and then utilize different sections of the response into different fields on the row?

Hi @mr-oodler,

I’m not at a PC right now, I’m on my mobile. But I think I can still point you in the right direction.



You have two options:

  1. As you stated you could create multiple ChatGPT requests to have it output them separately, currently there is no way to track chat history, so you could simply in your next prompt reference the previous one by adding the result from the previous one

(e.g., inside the prompt where it pops up the options to insert previous pieces, click the little arrows beside the ChatGPT piece and reference that result, (assuming you only output the title and no system message)).

I believe you could also achieve the same result using Put/Get inside storage pieces, although, I feel that is overkill if doing the separately.

  1. You mentioned you are asking ChatGPT to output it in JSON format, after this you will need to add a code piece. In the key:value boxes at the top of the code piece you can enter title as the key, then for the value, the ChatGPT result, then you can parse it via code. Then there is also a piece that allows you to convert JSON to CSV and vice versa, in theory, Sheets uses CSV, so on pasting it should import correctly in multiple cells. You would likely also need a loop to iterate those values.

Note: if you take the separate approach you can output multiple Chat GPT results into the same output box. By this I mean the arrow pointing to the title in the second screenshot for the update row, you could put the result of each separate chat in here and separate them by commas, new lines, or even add your own text (these boxes work the same way as adding your prompt in the ChatGPT piece).

However, see the below reply, I think it will solve that part for you along with issue 2.

@ashrafsam made a great example flow demonstrating this part:

Hopefully, this helps, if not I can take a look when I get back from work this evening.

Kind regards

Hi @GunnerJnr ,

thx for that.

I am not sure why your screen shots are showing a gdoc, when I am using a gsheet?

ISSUE 1 - can u please respond to this query?

ISSUE 2 - tks for the json resp example/feedback but I have no idea how to use json, I just thought it may help by allowing me to select the response data I wanted from the 1 x gpt response.

Recap of my options.

Option 1

create 12 x ASK GPT pieces for the About-Us, Short-Description, Feature-Title[1], Feature-Title[2], Feature-Title[3], Feature-Title[4], Feature-Title[5] and Feature-Description[1], Feature-Description[2], Feature-Description[3], Feature-Description[4], Feature-Description[5].
that is 12 x gpt requests.

This option seems a little bonkers when the feature Titles and Responses could all be done in 1 x GPT request… so the dilemma is how to separate the response data and put those responses into their associated fields.

As a recap, we have 1 x line on a g-sheet with a brand name, like NIKE.
We simply want to get gpt to create a description, short heading and five feature titles and descriptions for this brand and put those responses into the same row.

Can you provide any Option 2 solution?
You said Storage Post/Get may be overkill, maybe this is the best solution and if so, can you set up how we would use this in this example?

Its taken 2 x wks to get this far, is there a live support of consulting service we can engage to help us get this done quickly?


Hi @mr-oodler

Because I wasn’t at a PC at the time, and I had previously taken screenshots in a different post to demonstrate that you could place multiple outputs into the results, I just reshared the image here to demonstrate.

Regardless of it showing a GDoc, the same can be done in GSheets and other pieces.

For this, you can do this:

Then, it will automatically update the value to the new row number.

It should just be noted that I am only a community member like yourself. I do not work for or have any affiliation with ActivePieces. So, the help I am providing is that from a community standpoint. When you are inside a flow to create it, you might notice that towards the top right is a link for ‘Support.’ On clicking it, you are redirected to the community. So, I believe this is the official place for ‘live’ support.

In any case, I have been running (many, many) tests this morning on a flow that I think might work for you. It handles a couple of use cases in the code and checks for JSON objects and arrays of JSON objects. The reason for this is that the Ask ChatGPT seems to be very inconsistent on each run, regardless of the prompt provided. Unfortunately, that is out of my control. To handle this when it happens, I have also added checks in the code that will output ‘null’ or ‘error messages’ in the cell. 9 times out of 10, you can delete the row that had an error, then place it in another new cell, and it seems to run as expected on another try. So note that it is far from perfect. However, it mostly does what you require.

Other things to note:

  • When you enter new rows, remember it can take a couple of minutes before the flows will run. Also, due to the amount of content being generated at once, it can also take a minute to appear in the sheet.
  • Bear in mind Open AI also have request limits, so it could be that due to the sheer amount of request and content, it might time out or hit the limit. Add the affected rows as new rows and run them again in these instances.
  • When inserting rows, remember that it will only run (poll) a maximum of 10 at a time.

Here is a URL to the template flow I have created for you. - Activepieces

I have labelled each action according to the columns you requested above.

Here is a Google sheet, which I used for the testing. - Multiple GPT Request Demo - Google Sheets.

You’ll likely need to download it, make a copy, or replicate it. If your sheet is different, you will likely need to modify the flow to match. You will see it has all the columns that you require.

However, I added 2 additional columns at the start, Brand and Product Name. These are the only 2 columns you need to input any data for the flow to work.

  • Row A2: This is the row I used inside the flow on creation for Testing the Sample Data.
  • Rows A3 - A7: These rows containing the data were added after the flow was published. (e.g., these are the new rows that activated the New Row trigger). As you can see, it did a pretty good job of providing all of the information from just a Brand and Product Title.
  • Sheet 2: This is just where I gathered some dummy data to test. I find this easier because it can just be copied and pasted over. I am unsure if the flow would be triggered as soon as you start to type in a brand and perhaps run before you have had a chance to enter the product name, so it makes more sense to have this data ready elsewhere and paste it in.

You are free to use it as you see fit, modify it for your own purpose, change the prompts, etc.

Hopefully, this is what you are seeking. If not, perhaps a staff member of ActivePieces can jump in to provide additional help. But it should hopefully give you a better idea of how things can work and where things can go.

If you have any questions, feel free to ask.

Kind regards.

Hi @GunnerJnr ,

I am SO sorry, I thought you were Active Pieces Support Staff.

We are incredibly grateful for your support! Huge thx.

Your flow all made sense to me and all works really well now!

Few tweaks on the prompts and I think I can close this one down, give me a few days.

Again, your awesome, big thanks!


1 Like

No problems at all. I hope it helps.

Kind regards

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.