sush-plugin-spreadsheet
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

sush-plugin-spreadsheet

NPM

standard-readme compliant npm

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

  1. Create Google Spreadsheet
  • First line is header which has id, url, (optional timestamp)
  • See Example
  1. Publish Spreadsheet to the Web
  1. 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

/sush-plugin-spreadsheet/

    Package Sidebar

    Install

    npm i sush-plugin-spreadsheet

    Weekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • 3846masa