All Projects → sheetdb → Sheetsu Web Client

sheetdb / Sheetsu Web Client

Sheetsu Web Client

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sheetsu Web Client

Combinefirebase
Combine wrapper on Google's iOS Firebase library.
Stars: ✭ 126 (-24.55%)
Mutual labels:  google, database
How To Prepare For Google Interview Swe Sre
This repository includes resources which are more than sufficient to prepare for google interview if you are applying for a software engineer position or a site reliability engineer position
Stars: ✭ 251 (+50.3%)
Mutual labels:  google, database
Speedment
Speedment is a Stream ORM Java Toolkit and Runtime
Stars: ✭ 1,978 (+1084.43%)
Mutual labels:  database
Load Google Maps Api
🌏 A lightweight Promise-returning helper for loading the Google Maps JavaScript API
Stars: ✭ 166 (-0.6%)
Mutual labels:  google
Pg hashids
Short unique id generator for PostgreSQL, using hashids
Stars: ✭ 164 (-1.8%)
Mutual labels:  database
Turnstile
An authentication framework for Swift.
Stars: ✭ 163 (-2.4%)
Mutual labels:  google
Skiplist
Fast and easy-to-use skip list for Go.
Stars: ✭ 165 (-1.2%)
Mutual labels:  database
Vue Materialize Datatable
A fancy Materialize CSS datatable VueJS component.
Stars: ✭ 162 (-2.99%)
Mutual labels:  database
Esp32 arduino sqlite3 lib
Sqlite3 Arduino library for ESP32
Stars: ✭ 167 (+0%)
Mutual labels:  database
Stackdriver exporter
Google Stackdriver Prometheus exporter
Stars: ✭ 164 (-1.8%)
Mutual labels:  google
Usaspending Api
Server application to serve U.S. federal spending data via a RESTful API
Stars: ✭ 166 (-0.6%)
Mutual labels:  database
Replacegooglecdn
♋ 一个 Chrome 插件:将 Google CDN 替换为国内的。
Stars: ✭ 2,400 (+1337.13%)
Mutual labels:  google
Cl Dbi
Database independent interface for Common Lisp
Stars: ✭ 162 (-2.99%)
Mutual labels:  database
China Domain Allowlist
常用中国网站白名单,纯列表,用于 SwitchyOmega,控制不走代理的网站。
Stars: ✭ 166 (-0.6%)
Mutual labels:  google
Vscode
Connect to MongoDB and Atlas and directly from your VS Code environment, navigate your databases and collections, inspect your schema and use playgrounds to prototype queries and aggregations.
Stars: ✭ 161 (-3.59%)
Mutual labels:  database
Ohmysql
Easy direct access to your database 🎯 http://oleghnidets.github.io/OHMySQL/
Stars: ✭ 166 (-0.6%)
Mutual labels:  database
Crud
CRUD is Really Urgly coDed -- 万能快速原型系统
Stars: ✭ 162 (-2.99%)
Mutual labels:  database
Node Oracledb
Oracle Database driver for Node.js maintained by Oracle Corp.
Stars: ✭ 2,018 (+1108.38%)
Mutual labels:  database
Cs offer
计算机学科基础知识和主流编程语言相关内容的总结
Stars: ✭ 2,016 (+1107.19%)
Mutual labels:  database
Enumdb
Relational database brute force and post exploitation tool for MySQL and MSSQL
Stars: ✭ 167 (+0%)
Mutual labels:  database

Sheetsu Web Client

Google Spreadsheets as a website database. Store, edit and analyse data even with no knowledge of SQL. With few lines of code you can read and write data to Google Spreadsheets.

Quick start

  1. Read data from database
  2. Search
  3. Read and update HTML elements
  4. Save data
  5. Plot chart

Other

Go to Sheetsu website →

All examples shown below run on this Google Spreadsheet file.

Read data

Read data from Google Spreadsheets anywhere on the web. It works with ALL website builders, browsers, and front-end technologies.

<head>
  <!-- Add Sheetsu Web Client script to the head -->
  <script src="//script.sheetsu.com/"></script>
</head>

<body>
  <script>
    // In this example data is saved to the window.users variable
    // So it's available for use anywhere in the app/page
    function successFunc(data) {
      console.log(data);
    }

    function errorFunc(e) {
      console.log(e);
    }

    // Use Sheetsu.read to get data from a spreadsheet.
    // Pass callback function, which takes one argument - data
    // It's triggered after getting data from API
    Sheetsu.read("https://sheetsu.com/apis/v1.0/020b2c0f/", {}).then(successFunc, errorFunc);

  </script>
</body>

Play with the live version of the code on CodePen

Search

Search Google Spreadsheets for a record that matches your criteria.

<head>
  <!-- Add Sheetsu Web Client script to the head -->
  <script src="//script.sheetsu.com/"></script>
</head>

<body>
  <script>
    // Print out data to the console
    function successFunc(data) {
      console.log(data);
    }

    function errorFunc(e) {
      console.log(e);
    }

    // Use Sheetsu.read to get data from a spreadsheet.
    // Pass search with JSON to perform a get only results matching your criteria
    var searchQuery = { score: 42 };
    // Pass callback function, which takes one argument - data
    // It's triggered after getting data from API
    Sheetsu.read("https://sheetsu.com/apis/v1.0/020b2c0f/", { search: searchQuery }).then(successFunc, errorFunc);
  </script>
</body>

Play with the live version of the code on CodePen

Read and update HTML elements

Get elements from Google Spreadsheets and show them on the web.

<head>
  <!-- Add Sheetsu Web Client script to the head -->
  <script src="//script.sheetsu.com/"></script>
</head>

<body>
  <ul id="list"></ul>

  <script>
    // API returns array of objects
    // Iterate over them and add each element as a list element
    function successFunc(data) {
      data.forEach(function(item, i) {
        document.getElementById("list").innerHTML += "<li>" + item.name + " " + item.score + "</li>";
      });
    }

    function errorFunc(e) {
      console.log(e);
    }

    Sheetsu.read("https://sheetsu.com/apis/v1.0/020b2c0f/", {}).then(successFunc, errorFunc);
  </script>
</body>

Play with the live version of the code on CodePen

Save data

Save data from the form to the Google Spreadsheets

<head>
  <!-- Add Sheetsu Web Client script to the head -->
  <script src="//script.sheetsu.com/"></script>
</head>
<body>
  <form id="myForm">
    <input type="text" name="first_name">
    <input type="text" name="score">
    <button type="submit">Save</button>
  </form>

  <script>

    document.querySelector("#myForm").addEventListener("submit", function(e) {
      e.preventDefault();
      saveData();
    });

    function saveData() {
      // Get data from inputs
      var first_name = document.getElementsByName("first_name")[0].value,
          score = document.getElementsByName("score")[0].value;

      // Prepare JSON to be send
      var data = { name: first_name, score: score };

      // Save data to a spreadsheet
      // Arguments
      // 1 - API URL
      // 2 - JSON representation of a row you want to save
      // 3 - options
      // 4 - callback function after successful save
      Sheetsu.write("https://sheetsu.com/apis/v1.0/020b2c0f/", data, {})
        .then(function(x) {console.log(x);}, function(e) {console.log(e)});
    }
  </script>
</body>

Play with the live version of the code on CodePen

Plot chart

Plot chart with HighchartJS.

<head>
  <script src="https://code.highcharts.com/highcharts.js"></script>
  <script src="https://code.highcharts.com/modules/data.js"></script>
  <script src="https://code.highcharts.com/modules/drilldown.js"></script>
  <script src="//script.sheetsu.com/"></script>
</head>
<body>
  <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

  <script>
    Sheetsu.read("https://sheetsu.com/apis/v1.0/020b2c0f/", {}).then(successFunc);

    function successFunc(data) {
      Highcharts.chart("container", {
        chart: { type: "column" },
        title: { text: "Family Guy Score" },
        series: [
          {
            colorByPoint: true,
            data: data.map(function(item) {
              return { name: item.name, y: parseInt(item.score, 10) };
            })
          }
        ]
      });
    }
  </script>
</body>

Play with the live version of the code on CodePen

Installation

To install Sheetsu Web Client, just add

<script src="//script.sheetsu.com/"></script>

to the <head> of a website. Or anywhere else. It should work anyway :)

What is Sheetsu

Sheetsu is a connection between you and Google Spreadsheets, you can use anywhere on the web. You don't need to worry about authorization, refreshing tokens. You just speak with Google Spreadsheets, the easy language you know.

Go to Sheetsu website →

How to create Google Spreadsheets API?

1. Create a new Google Spreadsheets file

Open your browser and go to the Google Spreadsheets site. Create a new spreadsheet by clicking the "+" button. We will read data from this spreadsheet.

Go to Google Spreadsheets

Name your new spreadsheet.

Name spreadsheet

I named it "Example". Then add an example data. You can copy them from this doc. Remember about naming columns first.

Example data

2. Go to Sheetsu.com and sign up

When spreadsheet part is done, you need to Sign up to Sheetsu. Let's go to Sheetsu main page and click "SIGN UP" button in top-right corner of the website.

Sign up to Sheetsu

Sheetsu is using Google Authorization system, so you will be redirected to Google accounts page to give some permissions.

Accept Google permissions

If you accept them, click ALLOW button. And puff! It is done! We are on the dashboard.

3. Copy API URL from Sheetsu

To create an API you need to go back to your previously created spreadsheet and copy its URL.

Copy Google Spreadsheets URL

And the last thing to do is to paste this URL in your dashboard and click "CREATE API" button.

Create API

After that, your Sheetsu API will be created. You can click on a generatated link and see the results:

API ready to use

Docs

Sheetsu documentation sits on GitHub. We would love your contributions! We want to make these docs accessible and easy to understand for everyone. Please send us Pull Requests or open issues on GitHub.

Sheetsu.read(url, options)

Read data from Google Spreadsheet. Returns promis. options can be:

limit - number of how many rows should be returned
offset - number from which row response should start (default is 0)
transposed - transpose sheet on the fly. Default is false
sheet - name of worksheet you want to access. Also, can be a number, worksheet sare numbered from 0.
        Example:
        { sheet: "Sheet2" } - read data from worksheet named 'Sheet2'
        { sheet: 3 } - read data from fourth worksheet
search - object with search params to match searching criteria. Accepts '*' as a wildcard.
         Example:
         { search: { name: "Peter", score: 42 } } - return rows where name == Peter and score == 42
         { search: { name: "*is" } } - return rows where name ends with 'is'

All options can be used together
{ sheet: "Sheet2", search: { foo: "bar" }, limit: 1 } - return first row only from worksheet named "Sheet2", where column 'foo' equals 'bar'

Sheetsu.write(url, data, options)

Write data to Google Spreadsheet. Returns promis. data can be object - one row, or array similar to

{
  rows: [
    { name: "X", score: "1" },
    { name: "Y", score: "2" }
  ]
}

if you want to save more than one row in a single request. options can be:

sheet - name of worksheet you want to access. Also, can be a number, worksheet sare numbered from 0.
        Example:
        { sheet: "Sheet2" } - read data from worksheet named 'Sheet2'
        { sheet: 3 } - read data from fourth worksheet

Development

To test this library open SpecRunner.html in a web browser. All specs are written with Jasmine. Please keep in mind to keep this code as small as possible and to work on any kind of browser (yes, even old IE...).

Run all tests:

$ open `SpecRunner.html`

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sheetsu/sheetsu-js. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Pull Requests

  • Add tests! Your patch won't be accepted if it doesn't have tests.

  • Create topic branches. Please, always create a branch with meaningful name. Don't ask us to pull from your master branch.

  • One pull request per feature. If you want to do more than one thing, please send multiple pull requests.

  • Send coherent history. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before sending them to us.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].