How do you import data from chatbot to bar graph automatically?

Could anyone point out some suggestions on how to import data from the chatbot to the bar graph automatically?
From the results from this page
Screenshot 2024-03-30 4.02.15 PM
to this page
Screenshot 2024-03-30 4.02.27 PM
Any suggestions will be greatly appreciated!

what kind of data you get from the chatbot? show us in plain text here.

It's something like this.

This text follows a format that can be parsed to extract a dictionary of unit nutritional information.

The attributes are between the '-' and the ':' on each line (ending in \n)

The object key ('one medium sized apple') is at the front of the sentence ending in 'contains approximately:'

But then, how many other food types will come back in this format?

I don't know.

Thanks for the suggestion! I'm thinking of starting with a test run to see how it works. Once I've got that figured out, I'll then check how many different types of food I'll need. Any suggestions on how I can extract a dictionary of unit nutritional information and make this work?

It's impossible to predict any pattern with only one sample.

1 Like

You have a minimum of five different scales in your disparate dataset. How do you want to display these on a single bar chart? They will be fairly meaningless without a reference, perhaps daily recommended intake alongside each one ?

Yeah, I'm looking forward to displaying the chart as a daily recommended intake alongside each one.

Could you please guide me on how to do it?

You have the intake from one apple, a row in a table with five or six columns for the calories, vitamins, etc.

You need a row in a similar table with a day's minimum.

You need an. Input dialogue to accept how many apples were eaten that day, along with all the other foods that were eaten, to fill out the sheet of food nutrient quantities

I'm supposed to do that in Google Sheets right?

You need at least 2, maybe three sheets:

  • a reference table where you can look up all the different nutrients in any particular unit (medium size apple) of food
  • a daily log of the different foods and their quantities that were consumed, padded with the lookup values from the reference table
  • a reference table listing the different types of nutrients and their minimum daily requirements.

Each table would be a separate sheet, with its own headings and primary key.

Like this?

That design would have too many sheets, for so many types of food.

Instead, turn those 15 rows into columns, and fill in one row per food, all in the same sheet.
Each additional food type should be an extra row.

1 Like


Now you are ready for the third sheet, the detailed food log by date (and person if tracking multiple people).

The food log looks like the first sheet, except it has three extra columns at the left:

  • the person's name and category of person
  • the date of his consumption
  • the type of food
  • how much of that food he ate

The calories, fat, etc columns in each row could be multiplied by the quantity to get the contribution of that food to his daily consumption.

1 Like

Do I just make the names and their data randomly or am I just supposed to set up the sheet?

This sheet needs its headings.

Past that, you would have to write the app to feed it new rows as the user(s) eat.

No one would complain if you add a few test users and their fake consumption.

Like this?

That looks good.

Now you have two alternative ways to sum and group by user and date:

  • by Google Sheets expressions in a separate summary sheet
  • in your app, using advanced list filtering and sorting and grouping blocks.

It would not hurt to study both.