Giter VIP home page Giter VIP logo

gsx2json's Introduction

GSX2JSON - Google Spreadsheet to JSON API service.

About

One useful feature of Google Spreadsheets is the ability to access the data as JSON by using a particular feed URL. However, this is a bit fiddly to do, and the resulting JSON is pretty unreadable, with usable data buried deep inside objects.

This API connects to your spreadsheet and santizes the data, providing simple, readable JSON for you to use in your app.

Install

  • Get Google API key and add to api.js (line 1).
  • You must also enable the Google Sheets API and set up a service account.
  • Make sure your Google Sheet is set to be shared to 'anyone with the link'.
  • Run npm install.
  • Run node app.

Usage

First, you must make sure your Google Sheet is set to be shared to 'anyone with the link'.

You can then access your readable JSON API using the /api endpoint. You can change this in app.js.

http://example.com/api?id=SPREADSHEET_ID&sheet=SHEET_NAME

This will update live with changes to the spreadsheet.

Parameters

api_key (required): The API key set up in your Google developer account. You must also enable the Google Sheets API and set up a service account.

id (required): The ID of your document. This is the big long aplha-numeric code in the middle of your document URL.

sheet (required): The name of the individual sheet you want to get data from.

q (optional): A simple query string. This is case insensitive and will add any row containing the string in any cell to the filtered result.

integers (optional - default: true): Setting 'integers' to false will return numbers as a string.

rows (optional - default: true): Setting 'rows' to false will return only column data.

columns (optional - default: true): Setting 'columns' to false will return only row data.

Example Response

There are two sections to the returned data - Columns (containing the names of each column), and Rows (containing each row of data as an object.

{
	columns: [
		"Name",
		"Age"
	],
	rows: [
		{
		name: "Nick",
		age: "21"
		},
		{
		name: "Chris ",
		age: "27"
		},
		{
		name: "Barry",
		age: "67"
		}
	]
}

gsx2json's People

Contributors

55sketch avatar joao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gsx2json's Issues

"No entries returned. Do you have the right ID?"

I was using gsx2json for production, hosted in an Heroku app, and the app is not longer getting the sheet entries. I've read that API changed so I updated the files.

  1. I've read here that Google API changed, so I made a new project clone and added the API key.
  2. My ID is fine, I've test the gsx2json server to compare, and it works fine there but not in my Heroku own serve.

Always getting the same message: "No entries returned. Do you have the right ID?" Same ID works fine at gsx2json server. Please, can you give me some light to fix this issue?

Application error

Hi Nick, Joao,

Can API by GSX2JSON still work? it seems like an error. Kindly check and review. Thanks.

"An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command"

Best Regards,
Mustain

SSL issues

Hi!

Would be nice if you guys could configure a SSL certificate, can't request resources due to mixed content.

it doesn't work now..

i used gsx2json. it is very good so thank you for devoloping.

but it can't work.. :(...

Invalid hostname

Hello, I'm using your hosted version and we're getting an invalid hostname error since 2023-06-22 (around midday GMT) when we try and use the json file as a feed in Klaviyo (our email email marketing service, we use the the tool to populate sheet content into an email template).

The json feed still opens in the browser.

When I try the URL in an alternative service (https://codebeautify.org/jsonvalidator), this also returns an error with some more details:

Parse error on line 1:
The URL you entered 
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

These are the URLs I'm testing, one is our own and one is the example from your site. They both return the same error.

https://gsx2json.com/api?id=1EKVHceINR0lxLuSxEyQ8Ws0J043qnjRo1TSojJ7ExpM&sheet=Section1&api_key=AIzaSyBxIOxT-oakGgVBJ3eShluroMRIv3GnCKw
https://gsx2json.com/api?id=1I3tEfgYtWKNYK9vqTmsCGfZfbHckS0-odDIgEilHiOQ&sheet=Sheet1

Limits

How many rows can it handle? I have a doc with 100k but can't test it with http://gsx2json.com/api cause I'm getting «Application error» message from Heroku.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.