Add Row from ChatGPT Table

Looking to see if anybody has implemented the following:

Ask GPT a question and to display the answer in a table format.

Then Add rows to a Glide Table for each row in the ChatGPT Table.

For example, ChatGPT created the below table. I’d like to add a text entry component in my Glide App, where a user will enter a URL (https://www.druthersbrewing.com/menu/) and push a button. The Action will ask ChatGPT to organize the data in a table format and then add all the rows as separate rows to my Glide Table and inputting the correct info in the correct columns (Name, Description, Price).

Can this be done? In Glide only? Or do I need to leverage another program like Make?

Thanks!

Based on the Glide Bot it gives the following suggestion:

You can use the Glide Tables API to add a row from a ChatGPT Table into your Glide Table. Here are the steps:

  1. Create a new trigger in ChatGPT that will be triggered when a new row is added to the ChatGPT Table.

  2. Use Webhooks by Zapier to create a Custom Request action, which is also known as a Custom API call. In the Custom Request action, copy the Add Row API usage for Glide Tables API.

  3. In the Add Row API usage, replace “TABLE-NAME” with the name of your Glide Table and “COLUMN-NAME” with the name of the column in your Glide Table where you want to add the data from ChatGPT Table. Replace “COLUMN-VALUE” with the corresponding value from the ChatGPT Table.

  4. Save the Custom Request action and test it to make sure it is working properly.

3 Likes

One known way is to generate it as JSON, and replace the {" symbols with HTML tables tags

,,

I watched a video showing the exact steps but can’t recall the link, maybe someone else can provide it.
A good video on JSON will be from Create a Movies App (with Fetch JSON) | Glide Tutorial #nocode - YouTube
I can share my example for the prompt to get the JSON: "Generate a JSON object, meets this criteria "[Z]."(Insert any other criteria) Use this schema: [{"title": "Day 1 - things to do", "itinerary": "details", "location": "latitude,longitude"}]

Thanks I’ll check it out. Tried to play around with Zapier, but couldnt really figure out how to basically add each table row separately.

Also Id like to be able to create a checklist where the ones checked off are ultimately added to my Dish table. Guessing it would involve using a Helper Table to add all the dish rows. Then if a boolean column is true, add row to Dish Table.

Another suggestion via ChatGPT is:

To add each row from your table separately into your Glide app using the JSON API, you can send a POST request to the API endpoint for inserting a new row, with the data for each row in the request body.

Here’s an example JSON payload for inserting a new row with the Name, Description, and Price fields:

{
  "rows": [
    {
      "Name": "Nachos",
      "Description": "House-made chips, queso, black beans, pico de gallo, jalapeño crema, guacamole",
      "Price": "$14.95"
    },
    {
      "Name": "Pretzel Bites",
      "Description": "Sea salt, whole grain mustard, beer cheese sauce",
      "Price": "$10.95"
    },
    {
      "Name": "Mac & Cheese Bites",
      "Description": "Crispy bites filled with creamy mac & cheese, chipotle ranch",
      "Price": "$10.95"
    }
    // Add more rows here
  ]
}

To send this payload to the API endpoint for inserting a new row, you can use a tool like curl or an HTTP client library in the programming language of your choice. Here’s an example using curl:

curl --request POST \
  --url 'https://api.glideapps.com/v1/spreadsheets/SPREADSHEET_ID/tables/TABLE_ID/rows' \
  --header 'Authorization: Bearer ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "rows": [
      {
        "Name": "Nachos",
        "Description": "House-made chips, queso, black beans, pico de gallo, jalapeño crema, guacamole",
        "Price": "$14.95"
      },
      {
        "Name": "Pretzel Bites",
        "Description": "Sea salt, whole grain mustard, beer cheese sauce",
        "Price": "$10.95"
      },
      {
        "Name": "Mac & Cheese Bites",
        "Description": "Crispy bites filled with creamy mac & cheese, chipotle ranch",
        "Price": "$10.95"
      }
      // Add more rows here
    ]
  }'

Replace SPREADSHEET_ID, TABLE_ID, and ACCESS_TOKEN with your own values.

Note that in this example, the payload includes multiple rows in the rows array. You can add as many rows as you need by adding more objects to the array.

Not sure if this is accurate.

Isn’t a problem of this being your model has to be able to browse? What do you do if it can’t browse?

What do you mean by browse?

One issue Im finding is that I cant seem to isolate a table row to add that specific row into my Glide Table.

I mean you are telling the user to enter a URL and then expect the model to get the content of it? Would this URL change based on the user? I’m asking what would you do if it can’t browse and parse content from the URL.

Ah. Yes each restaurant owner would add their own URL to their online menu, which would be fed into the model to generate a table of all their menu items.

If there are no results then they would need to manually add each menu item via a form.

What about passing it to Make and use a service to grab the screenshot of the website, OCR it, and use ChatGPT to return it in a JSON structure?

That could work, I just have zero knowledge with JSON lol. I know some also use PDFs for their menus, so guessing this type of solution could work for both?

Yeah I think so, when you use a screenshot it can work with anything, but hopefully ChatGPT is consistent enough when working with the OCR result.

1 Like

Do you use any specific commands or prompts to tell ChatGPT to add a row to the table?

Never got this to really work but with Glides new AI and JSON columns, along with the Miracle Method, I think this is now possible.

1 Like