Basic Google script to pull OpenAI RSS updates

Googlescript in Google Sheets

function fetchOpenAIChangelog() {

ย  const feedUrl = "https://openai.com/blog/rss.xml";
ย  const sheetName = "OpenAI Feed";
ย  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
ย  const response = UrlFetchApp.fetch(feedUrl);
ย  const xml = response.getContentText();
ย  const document = XmlService.parse(xml);
ย  const items = document.getRootElement()
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  .getChild("channel")
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  .getChildren("item");
ย  const newRows = [];

ย  for (let i = 0; i < items.length; i++) {
ย  ย  const item = items[i];
ย  ย  const title = item.getChildText("title");
ย  ย  const link = item.getChildText("link");
ย  ย  const pubDate = new Date(item.getChildText("pubDate"));
ย  ย  const description = item.getChildText("description");

ย  ย  // Check if this link already exists in the sheet
ย  ย  const existingLinks = sheet.getRange("D2:D" + sheet.getLastRow()).getValues().flat();
ย  ย  if (existingLinks.includes(link)) continue;
ย  ย  newRows.push([pubDate, "OpenAI", title, link, description]);
ย  }
ย  if (newRows.length > 0) {
ย  ย  sheet.getRange(sheet.getLastRow() + 1, 1, newRows.length, 5).setValues(newRows);
ย  }
}