我正在尝试使用 javascript 将 json 数据渲染到 google 工作表。
我尝试搜索大量文档,并且已经尝试了几个小时。我确实在工作表中输入了一行数据,但我需要在正确的行和列中渲染整个 json 数据集
function renderJSON() {
/* This function collects JSON data from a specified endpoint
and renders the data to a spreadsheet */
// Fetch JSON data from the endpoint
var url = 'http://dummy.restapiexample.com/api/v1/employees';
var response = UrlFetchApp.fetch(url); // Get the JSON data
var object = JSON.parse(response.getContentText());
//Logger.log(response);
// Define an array of all object keys
var rows = []; // Declare an empty array
rows.push(object);
var headerRow = Object.keys(rows);
// Define …Run Code Online (Sandbox Code Playgroud)