Skip to content

Instantly share code, notes, and snippets.

View Ganapathiraj-A's full-sized avatar

Ganapathiraj-A

View GitHub Profile
@Ganapathiraj-A
Ganapathiraj-A / gist:47f686f8d5aabe332c2aca38b5bd6723
Created August 2, 2018 06:35 — forked from daaain/gist:3932602
Google App Script - Spreadsheet JSON export
/**
* Adds a custom menu to the active spreadsheet, containing a single menu item
* for invoking the exportJSON() function specified above.
* The onOpen() function, when defined, is automatically invoked whenever the
* spreadsheet is opened.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
@Ganapathiraj-A
Ganapathiraj-A / gist:92236d5721e34356bbc98d25e9800ca6
Created August 2, 2018 06:33 — forked from mhawksey/gist:1442370
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}