@guidb/google-sheets

0.0.1 • Public • Published

Buy Me A Coffee


Content-Library

  • 📰 0% Ads
  • 💸 0% Tracker
  • 📃 0% Logging

Docs

  1. Get All getAll(range_name) example

const { googleSheets } = require("@guidb/google-sheets")
async function test() {
  var db = new googleSheets("your_sheet_id", "credentials.json")
  var range_name = "Sheet1!A2:Z";
  var data = await db.getAll(range_name)
  console.log(JSON.stringify(data, null, 2))
}

test()
//--! Result log here !--\\
/*
[
  [
    "12345",
    "azkadev",
    "azka"
  ],
  [
    "123456",
    "devano",
    "devan",
    "alaska"
  ],
  [
    "1234567",
    "",
    "farel",
    "farel"
  ]
]
*/

  1. Get getRow db.getRow(range_name, user_data, get_row_num, return_row_number) example
const { googleSheets } = require("@guidb/google-sheets")
async function test() {
  var db = new googleSheets("your_sheet_id", "credentials.json")
  var range_name = "Sheet1!A2:Z"; //--! fil your range_name !--\\
  var user_data = "12345" //--! fill find data !--\\
  var get_row_num = 0 //--! the data is 0 because it is in range a, if b is 1 and next !!--\\
  var return_row_num = 1 //--! retur row b if you want c fill 2 next... !--\\
  var data = await db.getRow(range_name,user_data, get_row_num, return_row_num)
  console.log(JSON.stringify(data, null, 2))
}

test()
//--! Result log here !--\\
/*
"azkadev"
*/

  1. Get getRows getRows(range_name, user_data, get_row_num) example
const { googleSheets } = require("@guidb/google-sheets")
async function test() {
  var db = new googleSheets("your_sheet_id", "credentials.json")
  var range_name = "Sheet1!A2:Z";
  var user_data = "12345"
  var get_row_num = 0
  var data = await db.getRows(range_name,user_data, get_row_num)
  console.log(JSON.stringify(data, null, 2))
  console.log(JSON.stringify(data, null, 2))
}

test()
//--! Result log here !--\\
/*
{
  "0": "12345",
  "1": "azkadev",
  "2": "azka"
}
*/

Before

After

  1. save save(range_name, user_data, array_save, array_update, range_name_update) example
const { googleSheets } = require("@guidb/google-sheets")
async function test() {
  var db = new googleSheets("your_sheet_id", "credentials.json")
  var array_save = [ "data1", "data 2", "data 3" ]
  var array_update = [ "data1", "data 2 update", " data 3", "new data" ]
  var range_name = "Sheet1!A2:Z";
  var range_name_update = "Sheet1!A:Z"
  var data = await db.save(range_name, array_save[0], array_save, array_update, range_name_update)
  console.log(JSON.stringify(data, null, 2))
}

test()
//--! Result log here !--\\
/*
true
*/

Before

After

  1. saverow saveRow(range_name, user_data, get_row_num, new_data, range_name0) example
const { googleSheets } = require("@guidb/google-sheets")
async function test() {
  var db = new googleSheets("your_sheet_id", "credentials.json")
  var range_name = "Sheet1!A2:Z";
  var range_name_update = "Sheet1!A:Z"
  var data = await db.saveRow(range_name, 123456, 0, "gibran", "Sheet1!C")
  console.log(JSON.stringify(data, null, 2))
}

test()
//--! Result log here !--\\
/*


*/

Before

After

  1. saverows saveRows(range_name, user_data, get_row_num, new_data_array, range_name_update, range_name_update0) example
const { googleSheets } = require("@guidb/google-sheets")
async function test() {
  var db = new googleSheets("your_sheet_id", "credentials.json")
  var range_name = "Sheet1!A2:Z";
  var data = await db.getRow(range_name, user_data, get_row_num, return_row_number)
  console.log(JSON.stringify(data, null, 2))
}

test()
//--! Result log here !--\\
/*


*/

To-Do

A list that i should do more for this project...

  • crud
  • 🔜 clone
  • 🔜 diagram

🖥Requirements

  • Node v10+ (Node v14 Recommended)
  • Network connection

Package Sidebar

Install

npm i @guidb/google-sheets

Weekly Downloads

1

Version

0.0.1

License

GPL-3.0

Unpacked Size

53.2 kB

Total Files

4

Last publish

Collaborators

  • azkadev