scraly/developers-conferences-agenda

Adding somewhere an App Script example for Google Spreadsheet to import the events list in a table

Closed this issue · 3 comments

I built a Google Spreadsheet App Script that imports the json file of all the events into a Google Spreadsheet table, I think is also valuable for other people, and maybe makes sense to have it somewhere in the repo or in the interface.

Here is the code:

function ImportEvents() {
  var jsondata = UrlFetchApp.fetch("https://developers.events/all-events.json");
  var object   = JSON.parse(jsondata.getContentText());
  var data = new Array();
  data[0] = ["Start Date", "End Date", "Name", "Hyperlink",	"City", "Country", "Cfp Link", "Cfp Until"];
  for (x in object) {
    data.push([
      new Date(object[x].date[0]),
      object[x].date.length > 1 ? new Date(object[x].date[1]) : '',
      object[x].name,
      object[x].hyperlink,
      object[x].city,
      object[x].country,
      object[x].cfp.link,
      object[x].cfp.untilDate ? new Date(object[x].cfp.untilDate) : '',
    ]);
  }
  return data;
}

@scraly any opinion about this?

Thanks for the reminder
When I will be at home I'll take a look and see where to add it in the code organization :)

thx

I copied the script in the repository :)

thanks