Skip to main content

I have a ChatGPT 'Conversation' Action event that takes a block of text as input and the prompt generates multiple rows of data. Below is a simple example of the reply.

How do I store each row as a row in a Google Sheet or Excel?

I tried using ChatGPT's "Extract Structured Data" Action Event, but it only generates for the first row and ignores the rest.

  

---

**Task Title: Schedule Follow-up Meeting**

**Task Description:** Schedule followup meeting in two weeks and invite all stake holders.


---

**Task Title: Research Industry Regulations**

**Task Description:** Reserch regulations and laws realted to project and circulate with all stakeholders before next meeting.


---
 

Hi @Jay Summers 

For us to have more info, post screenshots of the data returned from ChatGPT that you are trying to use.

You may need to use a Formatter > Utilities > Text to Line Items step to create line items.


Hi @Troy Tessalone -

 

Below is what ChatGPT is returning. 

 

---

**Task Title: Schedule Follow-up Meeting**

**Task Description:** Schedule followup meeting in two weeks and invite all stake holders.


---

**Task Title: Research Industry Regulations**

**Task Description:** Research regulations and laws related to project and circulate with all stakeholders before next meeting.


---


@Jay Summers

Did you try this suggestion?

You may need to use a Formatter > Utilities > Text to Line Items step to create line items.

 

For us to have true context, post screenshots showing the data returned from the ChatGPT Zap step that you are trying to use.


I tried Text to Line Items. But I got stuck the fact that it seems to be expecting comma delimited text.

 

I believe ChatGPT APIs support outputting in JSON format, which would be the cleanest output. But I could not find anything on whether Zapier supports JSON mode for ChatGPT. 


@Jay Summers 

Ok, try this Zap step: Formatter > Text > Split

Output: all as line items

 

Then Zap action: GSheets - Create Multiple Row(s)


Thank you, but unfortunately Formatter > Text > Split does not work here. It splits each word of ChatGPT’s reply as Segment.

 

I will post some screenshots of flow in a few minutes.


Hello community.

 

Attached are screenshots of a very simple ChatGPT powered flow I am trying to build.

 

  1. Use form to capture meetings
  2. Send meetings notes to ChatGPT to review and extract action items assigned 
  3. Add those tasks into a Google Sheet.

 

I am stuck at how to parse the ChatGPT reply which contains multiple tasks and add them to Google Sheets.


@Jay Summers 

Screenshot does not show how the Formatter > Text > Split Zap step is configured in EDIT mode so we can see the field mappings and returned DATA OUT after testing.


Here are screenshots for the Spit Zap step.

 

 


@Jay Summers 

You need to specify a Separator value.

Click the field label to see a tooltip with more info.

Help links for using Formatter: https://zapier.com/apps/formatter/help

 


What Separator value would work here?

 

is there a trick to get the ChatGPT to format its reply in way that Formatter can understand? 


@Jay Summers 

Your DATA OUT from ChatGPT in the screenshot is separated by: ---

So that would be your separator to get each set as a line item.

Then you would need to use the Looping (Create Loop from Line Items) Zap app as a step to iterate thru each line item.

If you are trying to parse each of these into individual data points, you would need to add additional Formatter steps within the loop before this Zap action: GSheets - Create Row

  • Task Title
  • Task Description
  • Assigned To

 

There are more advanced ways to have ChatGPT output the results into a JSON structure, to then use a Code step to parse the JSON.

 

 


Using -- as separator does not really get you far. Screenshot attached. 

 

I am beginning to think this simple flow is not possible via Zapier’s current support for ChatGPT APIs because Zapier lacks a straight forward ability to output ChatGPT reply into an array structure that can then be imported into a sheet or table.

 

Thank you for all your effort to help me.


@Jay Summers 

It’s definitely possible, just not as plug and play as you might think.


Hi @Jay Summers 👋

Just came across the thread here and wanted to ask how things are going on this? Did you manage to get the desired line items set up in the end?

If so, we’d love it if you could share some details on how you solved it! 🙏

And if not, it looks like you might need to update that separator from -- to o:newline:]::newline:]---w:newline:]::newline:] in order to get each set of tasks grouped together into separate line items. I tested the following approach and it worked:

d26deafb4fe5d4735cdff2de08b65b59.png
NOTE: Ignore the text that was manually typed into the Input field (just done for testing purposes) you’d need to leave the previously selected Reply field from the ChatGPT action.


This helped to remove the line breaks before and after the --- too:
b39589017326776c2c898dba7318aa75.png
Then I used a Run Python Code by Zapier step to convert the line item data. I used the Generate with AI feature and that suggested the following code: 

tasks_data = input_data.get('tasksData', '')

# Split the tasks data into individual tasks based on the pattern
tasks = tasks_data.split(',')

# Initialize a list to hold the structured task information
grouped_tasks = /]

# Process each task entry
for task in tasks:
# Split the task entry into lines
lines = task.strip().split('\n')

# Initialize a dictionary to hold the task details
task_info = {}

# Extract title, description, and assignee from the lines
for line in lines:
if line.startswith('Task title:'):
task_info 'title'] = line.replace('Task title:', '').strip()
elif line.startswith('Task Description:'):
task_info 'description'] = line.replace('Task Description:', '').strip()
elif line.startswith('Assigned to:'):
task_info 'assignee'] = line.replace('Assigned to:', '').strip()

# Append the structured task information to the list
grouped_tasks.append(task_info)

# Prepare the output as a dictionary
output = {'tasks': grouped_tasks}

502229ea0ffa43303f9888e1a683368d.png
And that output the items like so:

e0e86bad92dc2bf9fc63119147c385d8.png
 

Then in a Google Sheets Create Multiple Spreadsheet Rows action I was able to select each set of values separately:

a2120841e1b7ef3204a064392f9a99e4.png
And it added them to my spreadsheet like so:

cf223eede39de3795e5d52a491bbac60.png
 

Hope that helps. If you give that a try please do keep us updated on how it goes, keen to help get this sorted! 🙂