node-googlesheet
v1.1.2
Published
A Node Package for smooth use of googlesheet programatically.
Downloads
8
Maintainers
Readme
node-googlesheet
Accelerate your productivity with this easy-to-use library for Node js
Installation
npm install node-googlesheet
The Most Stable Version is "v1.1.2" so kindly upgrade to same.
Sample Code to read data
const { GoogleSheet } = require("node-googlesheet");
// update below variables value with your credential details...
const client_id = "";
const client_secret = "";
const refresh_token = "";
const redirect_uri = "";
const gs = new GoogleSheet("client_id_client_secret", {
client_id, client_secret, refresh_token, redirect_uri
});
gs.setSpreadSheetToWorkWith(""); // For Ex: "1yFKedpLbKZ5MCHJaoXIz_9oc2_qoXZkUEyxTQQEfXtE"
(
async () => {
try {
const data = await gs.read();
console.log("Data : ", data);
} catch (err) {
console.log("err: ", err);
}
}
)();
Add Data
const res = await gs.append([2, "MK", 20]);
// append method takes two parameter having an array (array of values repesenting each cell) and second is string (range where you want to append the data)
console.log("res : ", res);
Update Data
const res = await gs.update([2, "MK", 20], "Sheet!A1");
// update method takes two parameter having an array (array of values repesenting each cell) and second is string (range where you want to append the data)
console.log("res : ", res);
Delete Rows / Column
const res = await gs.deleteRowsOrColumn({
sheetName: "Sheet1",
indexesToBeDelete: {
startIndex: 1, endIndex: 2
}
});
console.log("res : ", res);