In the example, we are going to play around with some of the data I used in Eurovision results with crossfilter and dc.js.
We have several thousand rows of data that starts like this
I'd like to create a summary sheet showing the total votes received for each country, and also sort this as well as the original data into reverse order of total votes received. You can do this is in juts a few lines of code.
First separate the data into header and data, then create an object that maps column names to the physical column they appear in the data. This means we can forget all about column numbers, or even change the shape of the sheet, and our subsequent code will still work.
And we're ready to output the result!
First sort the original data based on the total votes received for each country, and write it back to the original sheet in a new order
See Database abstraction with google apps script, Using crossfilter with Google Apps Script and Google Apps Scripts snippets for more like this, or for a complete solution see A functional approach to fiddling with sheet data
You want to learn Google Apps Script?
Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly.
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Google Apps Scripts snippets >