New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dataxcel

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dataxcel

Sebuah library sederhana untuk menggunakan Google Sheets sebagai database untuk operasi CRUD (Create, Read, Update, Delete).

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Google Sheet Simple DB

Sebuah library sederhana untuk menggunakan Google Sheets sebagai database untuk operasi CRUD (Create, Read, Update, Delete) di proyek Node.js.

✨ Fitur

  • Mudah dikonfigurasi dengan Spreadsheet ID dan kredensial Anda.
  • Mendukung operasi dasar: getAll, findBy, create, updateBy, dan deleteBy.
  • Dibangun di atas google-spreadsheet yang populer.

📦 Instalasi

npm install google-sheet-simple-db

🚀 Cara Penggunaan

Pertama, pastikan Anda sudah memiliki kredensial Service Account dari Google Cloud Console dalam bentuk file JSON.

Contoh Penggunaan di Server Express.js:

const express = require('express');
const GoogleSheetDB = require('google-sheet-simple-db'); // Impor library Anda
const creds = require('./path/to/your/credentials.json'); // Impor kredensial Anda

const app = express();
app.use(express.json());

// Inisialisasi Database
const db = new GoogleSheetDB({
    spreadsheetId: 'ID_SPREADSHEET_ANDA',
    credentials: creds,
    sheetName: 'maba2025' // Opsional, defaultnya 'maba2025'
});

// Route untuk mengambil semua data
app.get('/maba', async (req, res) => {
    try {
        const data = await db.getAll();
        res.json({ success: true, data });
    } catch (error) {
        res.status(500).json({ success: false, message: error.message });
    }
});

// Route untuk membuat data baru
app.post('/maba', async (req, res) => {
    try {
        const newData = await db.create(req.body);
        res.status(201).json({ success: true, data: newData });
    } catch (error) {
        res.status(400).json({ success: false, message: error.message });
    }
});

// Route untuk mencari berdasarkan NPM
app.get('/maba/:npm', async (req, res) => {
    try {
        const { npm } = req.params;
        const data = await db.findBy('npm', npm);
        if (!data) {
            return res.status(404).json({ success: false, message: 'Data tidak ditemukan' });
        }
        res.json({ success: true, data });
    } catch (error) {
        res.status(500).json({ success: false, message: error.message });
    }
});


const PORT = 3001;
app.listen(PORT, () => {
    console.log(`Server berjalan di http://localhost:${PORT}`);
});

📜 Lisensi

MIT

Keywords

google-sheets

FAQs

Package last updated on 16 Jul 2025

Did you know?

Socket

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.

Install

Related posts