Skip to content

callumlocke/parse-ft-spreadsheet-key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parse-ft-spreadsheet-key

Simple function to parse the spreadsheet key out from an FT Google Sheets URL or Bertha URL.

install

front-end

$ bower install --save parse-ft-spreadsheet-key
<script src="bower_components/parse-ft-spreadsheet-key/index.js"></script>

The function will be available as IG.parseSpreadsheetKey(str).

node.js

$ npm install --save-dev  parse-ft-spreadsheet-key
var parseSpreadsheetKey = require('parse-ft-spreadsheet-key');

usage

var key = parseSpreadsheetKey('https://docs.google.com/a/ft.com/spreadsheets/d/0Ajt08GcPGJRbdFJUZWZfZ6M1V0xDaTFBckJnNENC8Gc/edit#gid=0');

// key === '0Ajt08GcPGJRbdFJUZWZfZ6M1V0xDaTFBckJnNENC8Gc'

Notes:

  • takes valid Bertha URL or Google Spreadsheets URL
  • if you pass a plain key on its own, it will return it untouched
  • throws an error if something invalid is found, unless you pass true as a second argument (silent), in which case it just returns null

Build Status Dependency Status

About

Helper function for FT IG projects

Resources

Stars

Watchers

Forks

Packages

No packages published