# Saving data from OpenAI API to database

**URL:** <https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244>\
**Category:** APIs\
**Created:** [February 4, 2023, 10:13pm UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244 "2023-02-04T22:13:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlowe012](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rlowe012/32/214966_2.png) [@rlowe012](https://forum.bubble.io/u/rlowe012)\
**Post date:** [February 4, 2023, 10:13pm UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/1 "2023-02-04T22:13:55Z")

</div>

Hi,

I’ve got the following problem…

I want to ask OpenAI to send back a response to a query for a table of data in a format that would allow me to save it to the database.

For example, create a data table for 10 largest cities: name of city, populations, country, etc. Provide the data in X format.

OpenAIs returns a text response and I’m not sure if/how I could extract such data from a text response and save it as a ‘thing’ on the database.

Does anyone have any thoughts on how this might be possible?

Thanks!

---

<div class="post-metadata">

**Author:** ![Eugene\_West](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eugene_west/32/106508_2.png) [@Eugene\_West](https://forum.bubble.io/u/Eugene_West)\
**Post date:** [February 5, 2023, 1:56am UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/2 "2023-02-05T01:56:49Z")

</div>

Don’t forget to put your API key in Quickstart tab

Preview: [https://bubble-solutions.bubbleapps.io/version-test/openai?debug\_mode=true&section=usecases&subsection=table](https://bubble-solutions.bubbleapps.io/version-test/openai?debug_mode=true&section=usecases&subsection=table)  
Editor: [Bubble-solutions | Bubble Editor](https://bubble.io/page?type=page&name=openai&id=bubble-solutions&tab=tabs-1)

feel free ask Qs

---

<div class="post-metadata">

**Author:** ![rlowe012](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rlowe012/32/214966_2.png) [@rlowe012](https://forum.bubble.io/u/rlowe012)\
**Post date:** [February 5, 2023, 1:31pm UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/3 "2023-02-05T13:31:31Z")

</div>

Hey @Eugene_West this is cool! Thanks for sharing.

Is there a way of directly saving the list of JSON responses to the database, without having to hit save in each RG cell?

I’ve been trying to see if I can run an API workflow on a list of JSON texts but can’t seem to get it to work.

---

<div class="post-metadata">

**Author:** ![Eugene\_West](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eugene_west/32/106508_2.png) [@Eugene\_West](https://forum.bubble.io/u/Eugene_West)\
**Post date:** [February 5, 2023, 3:08pm UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/4 "2023-02-05T15:08:09Z")

</div>

This’s what i’m thinking to do in next changes

---

<div class="post-metadata">

**Author:** ![Eugene\_West](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eugene_west/32/106508_2.png) [@Eugene\_West](https://forum.bubble.io/u/Eugene_West)\
**Post date:** [February 5, 2023, 5:29pm UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/5 "2023-02-05T17:29:47Z")

</div>

Done. But you need a paid plan to run a recurring event to save all rows of the table at once

---

<div class="post-metadata">

**Author:** ![antonio.oriol](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@antonio.oriol](https://forum.bubble.io/u/antonio.oriol)\
**Post date:** [April 12, 2023, 10:29am UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/6 "2023-04-12T10:29:32Z")

</div>

Hello Eugene, I’m new to Buble and I need to do exactly what you have done in the “create spreadsheet” use case. But, as I’m very new in Bible and your app handles several use cases, for me is difficult copy the parts I need. Any suggestions?. Thank you.

---

<div class="post-metadata">

**Author:** ![rkresnadi](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rkresnadi](https://forum.bubble.io/u/rkresnadi)\
**Post date:** [September 2, 2024, 5:41am UTC](https://forum.bubble.io/t/saving-data-from-openai-api-to-database/245244/7 "2024-09-02T05:41:17Z")

</div>

hi @Eugene_West , which part of your action / workflow where you convert openAI response. all I see is just first item’s message: content…

I am thingking of extracting from, say, bulleted points:

then extract those city values into a table.

also, would something like this:

- City: Tokyo
- Population: 20 million

I want to put Tokyo in a field called city, and 20 million in population field.

can something like this be done?

Thank you 🙏
