从端点获取JSON数据并将其呈现到Google工作表

时间:2019-09-27 13:48:01

标签: javascript json

我正在尝试从端点检索JSON数据并将其存储在数组中,然后需要将其呈现到Google表格中。下面的代码是到目前为止的内容。

function renderJSON() {
  /* This function collects JSON data from a specified endpoint
  and renders the data to a spreadsheet */

  // Get the active spreadsheet
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var active = sheet.getActiveSheet();

  // Fetch the JSON data from the endpoint
  var endpoint = 'http://dummy.restapiexample.com/api/v1/employees';
  var json = UrlFetchApp.fetch(endpoint);
  var parse = JSON.parse(json);
  var rows = [];
  rows.push(json)

  // Render the data to the spreadsheet


  // Log data for debugging
  Logger.log(rows);

}

0 个答案:

没有答案