How to connect Equals and Monday.com via Javascript
Hi everyone - I’ve written a Javascript connection to bring data from a Monday board into Equals (a spreadsheet), so that I can better analyze some of the data that I track in Monday. Can someone help me with the code? Here’s what I have so far, and I’m getting feedback that indicates that something is wrong (I know my API key and Board ID are correct):
I’m trying to do as you say and write an API connection to Monday using your open API. I’ve tried with the following command (see below) and am getting feedback that there’s an issue with my Monday.com board permissions. Can you help point me in the right direction?
Thank you kindly,
Abbey
const equals = require(“equals”);
const axios = require(“axios”);
const luxon = require(“luxon”);
// Replace with your Monday.com API key
const apiKey = equals.getSecret(“monday_api_key”);
// Replace with the ID of your board
const boardId = equals.getSecret(“monday_board_id”);
const unixToDateTime = (unixTimestamp) =>
luxon.DateTime.fromSeconds(unixTimestamp).toFormat(‘yyyy-LL-dd HH:mm:ss’);
const getBoardData = async () => {
// Make a GET request to the Monday.com API to get the data for the board
const response = await axios({
method: “get”,
url: https://api.monday.com/v2/boards/${boardId}
,
headers: {
Authorization: Bearer ${apiKey}
,
Accept: “application/json”
}
});
return response.data;
}
const boardData = await getBoardData();
// Add the desired columns as headers
equals.addHeaders([“project”, “person”, “status”, “date”]);
// Loop through the items on the board and add each one as a row
boardData.items.forEach((item) => {
// You can customize this to add the desired data for each row
const rowData = {
project: item.columns.project.title,
person: item.columns.person.title,
status: item.columns.status.title,
date: unixToDateTime(item.columns.date.value)
};
equals.addRow(rowData);
})