Hi, Thanks for the reply.
I was hoping to use the query functionality within the API in order to select unique values from a large (3000x70) spreadsheet grid of data - which includes about 200 different values. It seemed like an efficient approach rather than walking through the grid and building out an array. Where I'm stuck, I think, is how one imports the API library into the spreadsheet script - perhaps a server-side version of:- <script type="text/javascript" src="http://www.google.com/jsapi"></script> and then:- google.load('visualisation','1'); ?? To be honest, I've a feeling that my issue is with JavaScript syntax rather than this API in particular, although a complete working example (e.g. link to a Google spreadsheet) would really help. The one on Google's page as per link below doesn't run. J. On Wednesday, March 7, 2012 5:39:23 PM UTC, Viz Kid wrote: > > > While writing a Google App Script, you probably don't need to load the > Google Visualization API for making queries. There is a service to > spreadsheet data related tasks ( > http://code.google.com/googleapps/appsscript/service_spreadsheet.html). > Also, there is a charts service to generate charts in spreadsheet from a > script which might be useful for you ( > http://code.google.com/googleapps/appsscript/service_charts.html). > > Hope this helps, > Viz Kid > > On Wed, Mar 7, 2012 at 12:53 PM, Jeremy Gooch < > [email protected]> wrote: > >> Hi, >> >> I'm trying to write a Google spreadsheet macro to process a large stack >> of data (e.g. to create a list of unique values from a wide range so I can >> generate some column headings on another sheet). I've previously used the >> Google query language API within Sites via data source >> URLs<http://code.google.com/apis/chart/interactive/docs/querylanguage.html#Setting_the_Query_in_the_Data_Source_URL>, >> >> so I thought I should be able to use a query within a JavaScript inside the >> source spreadsheet's script editor. >> >> However, when I run the script, I receive the error:- >> >> ReferenceError: "google" is not defined >> >> at the line >> >> var query = new google.visualisation.Query(--*URL--*). >> >> >> This is the page I was using as guidance -> >> http://code.google.com/apis/ajax/playground/?type=visualization#using_the_query_language. >> >> It seems to imply that it should just work. >> >> I feel I've fallen at the first hurdle! Is this API not compatible with >> spreadsheet scripts or is there something fundamental I've missed? Do I >> somehow need to declare the library within the script editor? I'm quite >> new to Google Apps and JavaScript but have long experience with VBA. I've >> got a basic spreadsheet JavaScript working (just counting columns). I've >> tried publishing the sheet but that didn't solve the error. >> >> We're Google Apps users, so the source spreadsheet is within our >> corporate domain inside Google, if that makes any difference. >> >> Thanks for any help, >> >> J. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-visualization-api/-/sDucOMa3rEoJ. >> 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. >> > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/ep7BAdxjvLIJ. 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.
