sush-plugin-spreadsheet
v1.0.1
Published
SUSH Plugin for fetching Google Spreadsheet.
Downloads
28
Maintainers
Readme
sush-plugin-spreadsheet
Fetch Google Spreadsheet.
Table of Contents
Install
For HTML
Insert script tags in your HTML.
<script src="https://unpkg.com/sush"></script>
<script src="https://unpkg.com/sush-plugin-spreadsheet"></script>
<!-- Add script tags of SUSH Plugins -->
Via Node.js
npm install --save sush sush-plugin-spreadsheet [...SUSH_PLUGINS]
Usage
Prepare
- Create Google Spreadsheet
- First line is header which has
id
,url
, (optionaltimestamp
) - See Example
- Publish Spreadsheet to the Web
- See Google Help
- Set spreadsheet URL to
sheetUrl
- URL must contain gid in hash or query
Via HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/sush"></script>
<script src="https://unpkg.com/sush-plugin-spreadsheet"></script>
<script src="https://unpkg.com/sush-plugin-redirect"></script>
<script>
var sheetUrl =
'https://docs.google.com/spreadsheets/d/XXXXXX_XXXXXX/edit#gid=0';
var sush = new SUSH();
sush.flow([
SUSH.$spreadsheet({ sheetUrl })
SUSH.$redirect({ fallback: './404.html' })
])
.catch((err) => {
// Throw error if not found
console.error(err.stack || err);
});
</script>
</head>
</html>
Via Node.js (e.g. Browserify, Webpack)
import SUSH from 'sush';
import spreadsheet from 'sush-plugin-spreadsheet';
import redirect from 'sush-plugin-redirect';
const sheetUrl =
'https://docs.google.com/spreadsheets/d/XXXXXX_XXXXXX/edit#gid=0';
const sush = new SUSH();
sush.flow([
spreadsheet({ sheetUrl })
redirect({ fallback: './404.html' })
])
.catch((err) => {
// Throw error if not found
console.error(err.stack || err);
});
Contribute
PRs accepted.
License
MIT © 3846masa