Google Sheets API - Not creating column content

Hi,

I’ve used some of the examples on here to develop an API load for data to a new board (the final location will change) and I’ve got the script creating the new item but it won’t load the content we want for the columns.

EG Item Name, Text Column, Date

Script happily creates the item but that is all. Board is mapped to the same structure etc so I’m not sure why this won’t run. Script is in Google App Script as we intend to use it to update regularly from a sheet, but we’re falling at thefirst hurdle.

I’ve looked at all the topics on here and the Quickstart guides.

function makeAPICall(key, query, variables) {

var url = “https://api.monday.com/v2”;

var options = {

“method” : “post”,

“headers” : {

"Authorization" : key,

},

“payload” : JSON.stringify({

"query" : query,

"variables" : variables

}),

“contentType” : “application/json”

};

var response = UrlFetchApp.fetch(url, options);

Logger.log("API results: " + response.getContentText());

return response;

}

function Create_Line() {

var mondayAPIkey = “YOUR KEY”

var boardID = YOUR BOARD

var variables = {

“myItemName” : “Hello, world!”,

“columnVals” : JSON.stringify({

"status" : {"label" : "Done"},

"date4" : {"date" : "1993-08-27"}

})

};

var query = ‘mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id:’+boardID+’, item_name:$myItemName, column_values:$columnVals) { id } }’;

makeAPICall(mondayAPIkey, query, variables);

}

Hi @robbo1975, welcome to the community!

Sorry to see that you’re running into some trouble setting up this integration. Just to clarify: you’re pulling data from your Google Sheet into your monday.com board, is that right?

Do you mind sending along any error messages you’re seeing? It would also help to see the payload you’re receiving from Sheets, and what that looks like.

Additionally, I would try parseing your makeAPICall to see if that helps at all! Something like this (from Dipro’s example code):

image

-Helen

Hi,

Yes I want to get data from a google sheet into monday.com every time the sheet is updated. The script is in the Google Sheet itself, so it’s a push rather than pull function.

If I wrap the column values in “” I get this error

image

I can create a new item, just not the column values.

Sorry! I updated my last message after some internal testing.

Does wrapping in parse() help at all?

Helen

Haha, no worries.

No, the function runs but the columns aren’t impacted. I just get a new item with “Hello, world!” and all other columns are blank (apart from the ID)

Hmm that’s so weird-- I just tested this out and it worked for me!

It looks like you may not be calling the correct column Ids. I see that in the screenshot you sent over, you don’t have a Date column added to this board. Do you mind adding one in, and then activating Developer’s Mode in your monday.labs section to find the relevant column Ids?

Here is more information on how to find and verify these column Ids: Where to find board, item, and column IDs – Support.

Let me know if this helps!

Helen

Oh I could kiss oyu right now (sorry I realise that’s tots inaprops) but that worked. It needed the column Ids to be defined as status9 and date8 (!!!)

Works great now.

Thank you :grinning: :grinning: :grinning:

I’m so glad to hear that @robbo1975!

-Helen