Create column and add values

I am trying to create a new column on an existing board and then add values to that column from a python list called hydrant_totals. I am able to create the new column but am unsure how to dump the 51 values contained within hydrant_totals into the new column. Note that the existing board contains the correct number of rows. Any guidance would be appreciated, I am new to GraphQL syntax. Thank you!

hydrant_totals = sorted([[k, v["TOTAL"]] for k, v in hydrant_stats.items()])
col_name ="%m/%d/%y")

query = """
            mutation ($colname: String!) {
                create_column (board_id: 172407875, title:$colname, column_type:numbers) {

                ....Want to now populate this new column with hydrant_totals

qvars = {"colname": f"COUNT {col_name}"}

api_r =
    json={"query": query, "variables": qvars},
    headers={"Authorization": os.getenv("MONDAY_TOKEN")},

Hi @jcla490, and welcome to our community!

Ahh okay, I see what you’re saying.

At this time, the only way to modify an item’s column value is to utilize one of two API methods: the change_column_value() mutation, and the change_simple_column_value() mutation.

This also means though, you will need to know the item IDs of all of these items in order to make these mutations. I’m afraid that you wouldn’t be able to modify all of the column entries for this new Numbers column in one fell swoop. You would need to modify them item by item.

For instance, if you have an item with ID 12345, your change_simple_column_value() could look something like this:

mutation { change_simple_column_value (board_id: 12345678, item_id: 12345, column_id: "numbers", value: 123) { id } }

You would then rinse and repeat for all 51 of your items and new entries.

Is this what you had in mind?

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