google app script: https://developers.google.com/apps-script/guides/sheets/functions
範例來自: http://dsernst.com/2015/07/16/how-to-make-programmatic-google-forms/
從 spreadsheet 抓資料
function getSpreadsheetData(sheetName) { // This function gives you an array of objects modeling a worksheet's tabular data, where the first items — column headers — become the property names. var arrayOfArrays = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName || 'Sheet1').getDataRange().getValues(); var headers = arrayOfArrays.shift(); return arrayOfArrays.map(function (row) { return row.reduce(function (memo, value, index) { if (value) { memo[headers[index]] = value; } return memo; }, {}); }); } |
沒有留言:
張貼留言