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

excel-as-database

v1.0.5

Published

Use Microsoft Excel as database

Downloads

10

Readme

Excel-as-Database

npm version

Excel-as-Database is a powerful Node.js package designed to leverage Microsoft Excel sheets as a lightweight and easy-to-use database solution. This package simplifies CRUD operations and enables developers to seamlessly interact with Excel files as if they were conventional databases.

Features

  • Simple Integration: Easily connect your Node.js application with Excel files, treating them as databases for data storage and retrieval.

  • SQL-like Operations: Utilize SQL-like syntax to perform CRUD operations (SELECT, INSERT, UPDATE, DELETE) on your Excel data.

  • Error Handling: Comprehensive error handling ensures robust performance even in challenging scenarios.

  • User-Friendly API: The package provides a straightforward API for developers to interact with Excel files programmatically.

  • Multiple Tables: Each sheet in the Excel file is treated as an individual table, allowing you to work with multiple tables within a single Excel document.

  • Extensive Data Checks: The package includes extensive checks on manually entered data in the Excel sheet, ensuring data integrity and preventing common errors.

Installation

npm install excel-as-database

How to use

  1. Connect to the excel file
const excelAsDatabase = require('excel-as-database');
const localExcelDb = new excelAsDatabase(`/your/absolute/folder/path/`);

await localExcelDb.createExcel(); // this will create a new Excel file at the provided folder path
  1. Create tables

    • Make sure you have an Excel file named ExcelDB.xlsx in the specified /your/absolute/folder/path/ folder.
    • Open ExcelDB.xlsx and refer to the 1st sheet, which acts as a template for creating other tables.
    • Explore and use sheets starting from the 2nd sheet onwards for creating new tables.
    • Utilize the structure and layout of the 1st sheet as a guide for designing your new tables.
    • Treat each sheet in ExcelDB.xlsx as a separate table.
    • Configure the table schema according to the image provided below:

    Table Schema

Ensure that you follow the specified folder path, use the correct Excel file (ExcelDB.xlsx), and refer to the provided image for setting up the table schema.

CRUD operations

  1. SELECT
const selectSql = { from: "users" }

const selectSql = { select: ["*"], from: "users"}

const selectSql = { select: ["rollNo", "name"], from: "users", offset: 10 }

const selectSql= {
    select: ["rollNo", "name", "surname"],
    from: "users",
    where: " name != 'john' ",
    orderBy: ["name desc"],
}

const selectSql = {
    select: ["rollNo", "name", "surname", "SUM(marks)", "AVG(marks)", "MAX(marks)", "MIN(marks)", "COUNT(marks)"],
    from: "users",
    where: "isActive != false and ( rollNo < 100 or name = 'john' ) and dob = 11/11/1995 and (marks + 10 > 50 )",
    groupBy: ["rollNo", "name", "surname"],
    having: "SUM(marks) + 5 <  150 ",
    orderBy: ["rollNo", "name desc", "surname asc"],
    limit: 4,
    offset: 2
}


const data = await localExcelDb.select(selectSql);
  1. INSERT
const insertSql = {
    table: "users",
    insert: [
        {
            name: "lee",
            isActive: true,
            surname: "Yu",
            dob: "13/06/1999",
            marks: 45
        }, {
            name: "mock",
            isActive: false,
            surname: "rid",
            dob: "13/06/1994",
            marks: 41
        }
    ]
}

await localExcelDb.insert(insertSql);
  1. UPDATE
const updateSql = {
    table: "users",
    set: {
        isActive: false,
        marks: 0
    },
    where: "dob = 11/07/1980 and marks <= 20"
}

await localExcelDb.update(updateSql);
  1. DELETE
const deleteSql = {
    from : "users",
    where : "isActive = false and marks <= 0"
}

await localExcelDb.delete(deleteSql);

Contributing

Feel free to contribute by opening issues, submitting pull requests, or suggesting improvements. Your feedback is valuable! Git repository - https://github.com/svfodekar/excelAsDatabase

Author

Saurabh Foddekar