
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
gsheet-to-json
Advanced tools
ES6 Module to fetch, read, process and format data from Google Spreadsheet to JSON
WARNING: This is an experimental package, and I don't recommend using this in a production environment.
This package is an ES6 module that helps you to fetch and process data from a public google spreadsheet.
First, you must publish your spreadsheet to the web, using File -> Publish To Web in your Google Spreadsheet.
You'll find your spreadsheetId
in your spreadsheet URL
In the screenshot above the spreadsheet URL is
https://docs.google.com/spreadsheets/d/1vETd54ohHGEWPbpnqBdmW8vXnQViIhmnGxOMo62qRzM/edit#gid=0
and the spreadsheetId is 1vETd54ohHGEWPbpnqBdmW8vXnQViIhmnGxOMo62qRzM
npm
npm install gsheet-to-json --save
yarn
yarn add gsheet-to-json
import gsheetToJson from 'gsheet-to-json'
// gsheetToJson returns a Promise and can be used with async/await or with then/catch callbacks
const getGotCharacters = async function () {
const gotCharacters = await gsheetToJson({
id: '1vETd54ohHGEWPbpnqBdmW8vXnQViIhmnGxOMo62qRzM'
})
console.log(gotCharacters)
}
getGotCharacters()
The result of gotCharacters
is:
{
"columns": {
"id": [
1,
2,
3
],
"name": [
"Robert Baratheon",
"Jaime Lannister",
"Catelyn Stark"
],
"age": [
38,
20,
35
],
"email": [
"robert@got.wic",
"jaime@got.wic",
"catelyn@got.wic"
]
},
"rows": [
{
"id": 1,
"name": "Robert Baratheon",
"age": 38,
"email": "robert@got.wic"
},
{
"id": 2,
"name": "Jaime Lannister",
"age": 20,
"email": "jaime@got.wic"
},
{
"id": 3,
"name": "Catelyn Stark",
"age": 35,
"email": "catelyn@got.wic"
}
]
}
Param | Options | Default | Description |
---|---|---|---|
id | string - required | none | The ID of your document. This is the big long aplha-numeric code in the middle of your document URL |
sheet | number - optional | 1 | The number of the individual sheet you want to get data from. Your first sheet is 1, your second sheet is 2, etc. If no sheet is entered then 1 is the default |
query | string - optional | none | A simple query string. This is case insensitive and will add any row containing the string in any cell to the filtered result. |
integers | boolean - optional | true | Setting 'integers' to false will return numbers as a string |
rows | boolean - optional | true | Setting 'rows' to false will return only column data. |
columns | boolean - optional | true | Setting 'columns' to false will return only row data |
This project was thoroughly encouraged and based on gsx2json by Nick Moreton
FAQs
ES6 Module to fetch, read, process and format data from Google Spreadsheet to JSON
The npm package gsheet-to-json receives a total of 0 weekly downloads. As such, gsheet-to-json popularity was classified as not popular.
We found that gsheet-to-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.