npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gsheet-to-db

v2.1.6

Published

Use Google Sheets as a database perform all CRUD opraction

Downloads

26

Readme

gsheet-to-db

npm

Example for gsheet-to-db GitHub repo link

https://github.com/saurabhgkp/gsheet-to-db-example

Easy to use and implement

SheetDB will turn your sheets into a JSON API, easy to integrate with other tools and all programming languages.

operations

You can read and edit your spreadsheet with GET, POST, PUT and DELETE requests with just a few lines of code.

FAQ

In Google Sheets you have to set data in header vale by manually first Field must be an 'id' and remaining is upto you

| id | Name | Status | Salary | | ------------- | ------- | -------- | -------- | | 1 | Wilson | FullTime | $40,000 | | 2 | saurabh | FullTime | $120,000 | | 3 | herry | FullTime | $40,000 |

 id |	 Name |    Status |	Salary
this field Are Add by manually field
may Different (As you Want 'id' is First Field !importent)

passing data in body is like


{
    "B":"herry",
    "C":"FullTime",
    "D":"$40,000"
}

always use capital letters ===> Don't A, This is use for 'id' use B C D to the Z for passing data

prerequisite

Activate Google Sheets API. Go to the Google console developer and enable Google Sheets API. https://console.cloud.google.com/apis/dashboard And get JSON key. DO NOT commit the JSON key! Add the file to .gitignore now and import it into the code! Or use environment variables.

Installation

Install my-project with npm

  npm i gsheet-to-db

Import

const { Gsheet } =  require("gsheet-to-db")
const  gdata  =  new  Gsheet("./keyFile.json", "spreadsheetId", "sheetName")

 let  data1  =  await  gdata.findAll()
 let  data2  =  await  gdata.findById(id)
 let  data3  =  await  gdata.create(data)
 let  data4  =  await  gdata.deleteById(id)
 let  data5  =  await  gdata.updateById(id, data)

Code Explanation

"./keyFile.json" this keysFile you can get it from Google console developer

spreadsheetIdyou can get from spreadsheet URL for example https://docs.google.com/spreadsheets/d/1JmpRfmEfSdVAxAu2SRvzsnswI1-ln-3F_1xtlg/edit?pli=1#gid=0 here after /d/ and before /edit is your spreadsheetId ="1JmpRfmEfSdVAxAu2SRvzsnswI1-ln-3F_1xtlg"

sheet name can be found at the bottom of spreadsheets by default is something like "sheet1"

let data3 = await gdata.create(data) here data must be started from "B" not "A". "A" is reserved for "id" for example

{
    "B":"herry",
    "C":"FullTime",
    "D":"$40,000"
    ...
}

for any help, you can DM me on LinkedIn

🔗 Links

linkedin