All Projects → idw111 → use-google-spreadsheet

idw111 / use-google-spreadsheet

Licence: other
react hook for using google spreadsheet as a data table (API endpoint)

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to use-google-spreadsheet

gsheet to arb
Import translations (ARB/Dart) from Google Sheets
Stars: ✭ 21 (-80.19%)
Mutual labels:  google-spreadsheet
Learn To Send Email Via Google Script Html No Server
📧 An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
Stars: ✭ 2,718 (+2464.15%)
Mutual labels:  google-spreadsheet
react-use-scroll-position
A react hook to use scroll position
Stars: ✭ 45 (-57.55%)
Mutual labels:  react-hook
meteor-google-spreadsheets
Google Spreadsheets for Meteor
Stars: ✭ 53 (-50%)
Mutual labels:  google-spreadsheet
Social-Media-Monitor
Automatically monitor and log fan counters from social media(Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using APIs to Google Spreadsheet. Very useful for website admins and social media managers.
Stars: ✭ 36 (-66.04%)
Mutual labels:  google-spreadsheet
use-countdown
⏳ useCountdown hook
Stars: ✭ 79 (-25.47%)
Mutual labels:  react-hook
php-google-spreadsheet-api
PHP library for read/write access to Google spreadsheets via the version 3 API.
Stars: ✭ 38 (-64.15%)
Mutual labels:  google-spreadsheet
use-key-hook
React hook to handle all the key press.
Stars: ✭ 27 (-74.53%)
Mutual labels:  react-hook
Luckysheet
Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.
Stars: ✭ 9,772 (+9118.87%)
Mutual labels:  google-spreadsheet
usehooks-ts
React hook library, ready to use, written in Typescript.
Stars: ✭ 2,873 (+2610.38%)
Mutual labels:  react-hook
node-sheets
read rows from google spreadsheet with google's sheets api
Stars: ✭ 16 (-84.91%)
Mutual labels:  google-spreadsheet
google-spreadsheet-cli
📊 CLI for reading and writing data into Google Spreadsheet
Stars: ✭ 51 (-51.89%)
Mutual labels:  google-spreadsheet
web
React hooks done right, for browser and SSR.
Stars: ✭ 940 (+786.79%)
Mutual labels:  react-hook
spreadsheet-to-json
Convert Google Spreadsheets to JSON using Javascript
Stars: ✭ 53 (-50%)
Mutual labels:  google-spreadsheet
veact
Mutable state enhancer library for React based on @vuejs
Stars: ✭ 62 (-41.51%)
Mutual labels:  react-hook
citybook
Create a resource directory from a contact spreadsheet.
Stars: ✭ 21 (-80.19%)
Mutual labels:  google-spreadsheet
sku-algorithm
商品多规格选择-sku算法
Stars: ✭ 108 (+1.89%)
Mutual labels:  react-hook
use-algolia
Dead-simple React hook to make Algolia search queries. Supports pagination out of the box.
Stars: ✭ 29 (-72.64%)
Mutual labels:  react-hook
ad localize
ADLocalize is a simple way to manage your localization files. Supported wording sources : CSVs and Google Sheets. Localization file generation available for iOS, Android, JSON (i18next), YAML and Java properties
Stars: ✭ 22 (-79.25%)
Mutual labels:  google-spreadsheet
use-async-resource
A custom React hook for simple data fetching with React Suspense
Stars: ✭ 92 (-13.21%)
Mutual labels:  react-hook

use-google-spreadsheet

helps developers use google spreadsheet as their data table (backend endpoint)

Live Demo

install

npm install use-google-spreadsheet

usage

  1. Configure Google Cloud Console to get API key for Google Sheets API (API_KEY)

    • It uses Google Sheets API v4, when API_KEY is given
    • If API_KEY is not given, it falls back to Google Sheets API v3 which would be deprecated soon
  2. Create a google spreadsheet

    • Insert keys in the first row
    • Insert values after first row
  3. Publish the spreadsheet to web (File > Publish to Web)

  4. Use the share url to fetch the data (File > Share)

  5. You'll fetch the spreadsheet as the following

spreadsheet

// fetched data (rows)
[
	{ "key1": "row1:value1", "key2": "row1:value2", "key3": "row1:value3" },
	{ "key2": "row2:value1", "key2": "row2:value2", "key3": "row2:value3" },
	{ "key3": "row3:value1", "key2": "row3:value2", "key3": "row3:value3" }
]

example

import useGoogleSpreadsheet from 'use-google-spreadsheet';

const SomeComponent = ({}) => {
	const API_KEY = 'XXXXXXXXXXXX';
	const shareUrl = 'https://docs.google.com/spreadsheets/d/1W5D9WvlrXvndEc0b42OsdzJTT1M-MxKVYdPEtleqRQY/edit?usp=sharing';
	const { rows, isFetching } = useGoogleSpreadsheet(shareUrl, API_KEY);
	return isFetching ? (
		<Spinner />
	) : rows ? (
		<ul>
			{rows.map((row, i) => {
				return (
					<li key={i}>
						{Object.keys(row).map((key, i) => (
							<span key={i}>
								{key}: {row[key]}
								<br />
							</span>
						))}
					</li>
				);
			})}
		</ul>
	) : (
		<span>No Data</span>
	);
};

api

useGoogleSpreadsheet

-   params @{string} shareUrl or sheetId
-   params @{string} apiKey (optional)
-   returns @{object}
    -   rows @{array}
    -   isFetching @{boolean}
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].