Skip to content

openknowledge-archive/datapackage-to-google-spreadsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

datapackage-to-google-spreadsheet

Import tabular data packages (http://data.okfn.org/doc/data-package) into Google Spreadsheets

Demo

To import a tabular data pacakage into Google Spreadsheets:

  1. Go to https://docs.google.com/spreadsheet/ccc?key=0AqR8dXc6Ji4JdG15Z1BhNXpCMFBnVTY5LUpoTGNrY0E#gid=0
  2. Make a copy of the sheet
  3. Go to Data Packages Menu -> Import Data (on the first run, you will be asked for authorization)
  4. Paste in the url: http://data.okfn.org/data/house-prices-us/datapackage.json
  5. Watch the data load!

Note: You can replace the datapackage.json url with any other tabular data package link

How it works

A small script is included in the spreadsheet. This in turn uses a library (the code from this repository) that loads and processes CSV data from the data package.

Do it yourself

To use the script in your own spreadsheets:

  1. In your spreadsheet open the script editor to create a new script

  2. Include the library. To do this:

    1. Go to Resources => Manage Resources
    2. Use the project id: MH6zwb-fUDq8QyPrl-PbJlu_4T1jeIs
    3. Make sure that the latest version is selected
    4. More information on using libraries can be found here: https://developers.google.com/apps-script/guide_libraries#useLibrary
  3. Copy and paste the following into your script and hit save:

function onOpen() {
DataPackages.onOpen();
}
function importDataPackageUi() {
DataPackages.importDataPackageUi();
}
  1. Hit run
  2. There is now a new Data Packages menu in your spreadsheet. Whenever you open the spreadsheet in the future it will be there.

Data Requirements

Currently, the library can cope with a single CSV file from a tabular data package. The field separator should be a comma, the text delimiter should be " and the line separator should be \n. That means we're not yet fully conformant with the specification, but this will hopefully be achieved soon via a more general API that pre-processes the data according to format and dialect.

Deploying

The contents of the file library.gs.js should replace the code here:

https://script.google.com/macros/d/1GLuZPrroyUP4WkHm4aAT4Z2QUqoL60LhEJnomYZT7nzaMDjptOneTNdJ/edit

The contents of the file linking_code.gs.js need to be placed in the spreadsheet script, and the README.md (this file) updated accordingly.

About

[EXPERIMENTAL] Import data packages (http://data.okfn.org/doc/data-package) into Google Spreadsheets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published