четверг, 22 апреля 2010 г.

Read Spreadsheet Cell Data with Javascript

 
<head>

<script type="text/javascript" src="http://www.google.com/jsapi"></script> - not sure if I need this
<script>
var worksheetJSON;
var chartData = Array();
var ds = {"gallery": [
{"name": "name", "breed": "breed", "sex": "sex", "dob": "dob", "status": "status", "profile": "profile", "image": "image", "srg": "srg"}
]
};

function loadWorksheetJSON(json) {
   worksheetJSON = json;
   for(i=0;i<worksheetJSON.feed.entry.length;i++) {
      entry = worksheetJSON.feed.entry[i];
      entrycell = Array();
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].name+".$t);
      alert(colstr);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].breed+".$t);
      alert(colstr);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].sex+".$t);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].dob+".$t);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].status+".$t);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].profile+".$t);
      alert(colstr);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].image+".$t);
      colstr = entrycell.push(entry.gsx$"+ds.gallery[i].srg+".$t);

      chartData.push(entrycell);
   }
<!-- go do stuff with chartData -->

}
</script>
<script src="http://spreadsheets.google.com/feeds/list/0AvRNyZCu4FyldFowU1hOdUJPbHJNUkVWZm1USTAyOEE/public/values?alt=json-in-script&callback=loadWorksheetJSON"></script>

</head>
<body>
</body>

Комментариев нет:

Отправить комментарий