November 15, 2013

How to Import Data to a Google Sites List Page

I discovered a script written by Romain Vialard that processes exporting/importing of data from/to a Google Sites List page using a Google Docs spreadsheet. If you would like to take advantage of Sites List features and formatting and have a long table of data to import, then the script is a real time saver. You can also export data from a Sites List page into the spreadsheet that contains the script. 
  • Create a new Google spreadsheet and choose Tools > Script Editor
  • Choose Spreadsheet under Create a Script For
  • Remove the sample script from Code.gs
  • Copy the script from this forum post and paste it into Code.gs
  • Name the project (e.g. Google Sites Export Import) and choose File > Save.
  • Under Select Function you will see (OnOpen, create_list, push_items, and fetch_items). 
  • Close the spreadsheet and re-open and there will be a new List page menu with the choices to Create a list or Fetch list items
  • To create a List page within your site choose List page > Create list. You may need to authorize the app to run. If so, choose List page > Create list again.
  • Provide the URL of the parent page (e.g. http://sites.google.com/site/joefahs/demographics) under which the list page will be created. 
  • Choose a name for your list page (e.g. countries). 
  • Wait patiently for the script to execute. 
  • Go to your page address (e.g. http://sites.google.com/site/joefahs/demographics/countries) to see your automatically created list page. Note! If the script is not available in the List page menu choose Tools > Script Manager and run your scripts from there. 
  • Push items will push data from the spreadsheet into an existing List page replacing the existing data in that list.  
  • You can retrieve data from a list page and put them in the spreadsheet by choosing the script Fetch Items. It will will require the list page's URL and number of columns and will import the data but not the header. You will need to add the headers in the spreadsheet and then sort as needed. 


Distraction Free Reading

You are not alone if you have struggled to keep your focus reading through articles on the web that are bombarded with still and animated...