Google sheets integration

I am trying to send Monday.com boards list and their items list to Google sheets with a column value. Here is my code:

function runMondayQuery() {
  const apiKey = 'YOUR_MONDAY_API_KEY';  // Replace with your actual API key
  const boardId = YOUR_BOARD_ID;         // Replace with your actual board ID (number, not string)

  const query = `
    query {
      boards(ids: [${boardId}]) {
        id
        name
        items_page(limit: 100) {
          items {
            id
            name
            column_values {
              id
              title
              text
              value
            }
          }
          cursor
        }
      }
    }
  `;

  const options = {
    method: 'post',
    contentType: 'application/json',
    headers: {
      Authorization: apiKey,
      'API-Version': '2023-10'
    },
    payload: JSON.stringify({ query })
  };

  const response = UrlFetchApp.fetch('https://api.monday.com/v2', options);
  const data = JSON.parse(response.getContentText());

  Logger.log(JSON.stringify(data, null, 2));
}

But I keep getting this error:
Response: {“errors”:[{“message”:“Cannot query field "items" on type "Board".”,“locations”:[{“line”:5,“column”:9}],“extensions”:{“code”:“GRAPHQL_VALIDATION_FAILED”}}]}

Hello @Gayathri ,

If your goal is to have data automatically reflected in a spreadsheet environament, one option you might consider is using Smart Spreadsheet directly inside monday.

With Smart Spreadsheet, you can:

• import your monday board into a spreadsheet-style view
• build formulas and reference data just like in Google Sheets
• keep the data two-way synchronized — changes in the spreadsheet update the board, and board updates reflect back in the sheet

You can then autoexport the file to email.

This removes the need to maintain an external Google Sheet just to mirror or update values.

Hope this helps!