<html>
<head>
<title>GoogleスプレットシートAPIテスト</title>
</head>
<body>
<div id="data"></div>
<script type="text/javascript">
<!--
function drawTable(json)
{
var table = document.createElement('table');
table.setAttribute('id', 'output');
var tbody = document.createElement('tbody');
var tr;
for (var i=0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
if (entry.gs$cell.col == '1') {
if (tr != null) {
tbody.appendChild(tr);
}
tr = document.createElement('tr');
}
var td = document.createElement('td');
td.appendChild(document.createTextNode(entry.content.$t));
tr.appendChild(td);
}
tbody.appendChild(tr);
table.appendChild(tbody);
document.getElementById('data').appendChild(table);
}
-->
</script>
<script type="text/javascript" src="https://spreadsheets.google.com/feeds/cells/0Akp-AdfTe-rCdDZEN2ZIWFMyMWhCV2dsRlkxb1N6bGc/od6/public/values?alt=json-in-script&callback=drawTable"></script>
</body>
基本ここのパクリが、時間あったらもうちょっと遊んでみるGoogle Docsの公開URLは
https://docs.google.com/spreadsheet/ccc?key=0Akp-AdfTe-rCdDZEN2ZIWFMyMWhCV2dsRlkxb1N6bGc
一般公開しているので、変なこと書き込まないでいただきたいm(_ _)m
結果はこれ:2011年世界GDP順位だそうです
Google Spreadsheets API
0 件のコメント:
コメントを投稿