將你的Google Spreadsheet 設定為公開

檔案>發佈到網路

取得Google Spreadsheet ID 並且建立API字串

從Google試算表網址欄,你會看到下方的字串,其中標示出ID的位置 請將ID字串複製起來

https://docs.google.com/spreadsheets/d/你的ID位置/edit#gid=0

並且貼在下方指示位置

https://spreadsheets.google.com/feeds/list/把你的ID在這貼上/od6/public/values?alt=json

附註說明: https://spreadsheets.google.com/feeds/{list or cells}/把你的ID在這貼上/{sheet index}/public/values?alt=json 其中, cells 與 list 會回傳不同的格式 sheet index則是代表要取得哪一個工作表,用數字表示

這時可以直接在網址欄貼上組合好的字串,會看到試算表中的json資料結構 就代表設定沒問題

使用 jQuery 取得資料

這裡則簡單示意如何直接透過jQuery取得資料

var Spreadsheet_path = 'https://spreadsheets.google.com/feeds/list/1rwBVJnKtXsyieDTm6GamklwRO3ACc1FP_FMPnmsF5D4/od6/public/values?alt=json';
var host_json = $.getJSON(Spreadsheet_path,{
  format: "json"
}).done(function(data){
  console.log(data);
});

進階版

https://developers.google.com/chart/interactive/docs/querylanguage https://chriszarate.github.io/sheetrock/