I have run the response.getDataTable function, and logged the returned elements/obejcts within the response array. The returned object is referenced with a "U" and the objects within, (Table labels, and table cell data/rows) are reference by a "B" and "G" respectively... yesterday they were "A" and "F". Have tried reading through tonnes of material about the API and JSON , but I really don't even know what I'm looking for... what are those parts of the response data, and why would their references change?
CODE HERE: var dataSourceUrl = 'http://spreadsheets.google.com/a/xxxxxxxxxxx.com/ tq?tqx=out:json&key=XXXXXxxxxxXXXXXxxxxx'; *XXX used as data is not yet public domain. var query; var table_keys = Array(); // contains array of Objects var table_rows = Array(); // contains array of Objects var table_whole = Array(); /* Called once Google is good and ready */ function init() { query = new google.visualization.Query(dataSourceUrl); query.send(handleQueryResponse); } /* Called when the query response is returned. */ function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; }else{ var data = response.getDataTable(); process_data(data); // Pass requested data to this function for processing console.log(data); } } /* Organise the data into easy-to-use arrays */ function process_data(data) { /* Loop through the key of the table (the first row) */ for (var key in data['B']){ if (data['B'].hasOwnProperty(key)) { table_keys.push(data['B'][key]); //TODO: Fix this looks really dodgy? } } /* Loop through the data (all subsequent rows) */ for(var keys in data['G']) { if (data['G'].hasOwnProperty(keys)) { table_rows.push(data['G'][keys]['c']); //TODO: Fix this looks really dodgy? } } -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
