Apps Developer Blog

Information for Google Apps Developers

Insider Tips for Using Apps Script and Spreadsheets

May 9, 2012
Share on Google+ Share on Twitter Share on Facebook
Google
Labels: Apps Script

3 comments :

SUKANYA said...

SEARCH POPULAR TOPICS

Job Tips, Interview Tips, Latest Text papers, Exam Results, Question papers, Answer papers, Job Applications, Online Education Topics.

http://online-education-topics.blogspot.com

May 13, 2012 at 11:52 PM
astilly said...

Keith,

Great post! Curious about the differences in column handling in what you're describing here around column numbers and the method that converts a range to a Javascript object method shown in the Apps Script tutorials. What are the relative advantages / disadvantages of each?

See the "Library" functions shown here: https://developers.google.com/apps-script/articles/reading_spreadsheet_data

Cheers,

Andrew

May 14, 2012 at 9:44 AM
Keith Howson said...

Thanks, Andrew.

The two are functionally the same at the end. As I see it, the advantages are:
- this is slightly more compact
- I can define the 'field' names myself, so can make them shorter, or entirely different than the column headings
- By defining the mapping (which isn't much), you have an instant reference for the expected column headings. You can use that in lots of handy ways (eg. check lots of spreadsheets to make sure they have the required headings).
- This creates a simple mapping of field names to column numbers, by only processing the single (heading) row. The example processes every row of data in order to create a new array of key-value pairs. That creates slightly more overhead.

Disadvantages are:
- You have to define the mapping.
- There could be others :D

May 18, 2012 at 7:41 AM

Post a Comment

  

Labels


  • .NET 3
  • #io15 1
  • Admin SDK 4
  • Administrative APIs 26
  • AdSense 1
  • analytics 4
  • Android 5
  • App Engine 5
  • Apps Script 98
  • Auth 1
  • billing 4
  • Charts 1
  • Chrome OS 1
  • classroom 1
  • Cloud Storage API 1
  • Community 1
  • Developers 5
  • Directory API 1
  • Drive 2
  • Drive SDK 38
  • execution API 1
  • Firebase 1
  • Freemium 1
  • Fusion Tables 2
  • Gadgets 5
  • Gmail APIs 16
  • Google APIs 3
  • Google Apps 3
  • Google Apps Directory API 1
  • Google Apps Marketplace 3
  • Google Apps Script 1
  • Google Calendar API 20
  • Google Contacts API 3
  • Google Data Protocol 7
  • google docs 3
  • Google Docs API 20
  • Google Drive 2
  • Google Forms 4
  • Google I/O 3
  • Google Prediction API 3
  • Google Profiles API 2
  • Google sheets 2
  • Google Sites API 4
  • Google Spreadsheets API 4
  • Google Talk 1
  • Google Tasks API 6
  • Google+ 3
  • googlenew 1
  • Groups 2
  • Guest Post 42
  • ISVs 2
  • java 1
  • JavaScript 3
  • marketing 3
  • Marketplace 47
  • Marketplace ISV Guest 21
  • Migration 1
  • Mobile 1
  • mpstaffpick 1
  • oauth 11
  • OpenID 7
  • PHP 1
  • python 4
  • realtime API 1
  • Resellers 2
  • Ruby 1
  • SaaS 1
  • security 1
  • Staff Picks 2
  • webinar 2


Archive


  •     2015
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
  •     2014
    • Dec
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Mar
    • Feb
    • Jan
  •     2013
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
    • Jan
  •     2012
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
    • Jan
  •     2011
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
    • Jan
  •     2010
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb

Feed

Company-wide

  • Official Google Blog
  • Public Policy Blog
  • Student Blog

Products

  • Android Blog
  • Chrome Blog
  • Lat Long Blog

Developers

  • Developers Blog
  • Ads Developer Blog
  • Android Developers Blog
  • Google
  • Privacy
  • Terms