Git Product home page Git Product logo

xlite's Introduction

XLite - query Excel (.xlsx, .xls) and Open Document spreadsheets (.ods) as SQLite virtual tables

XLite is a SQLite extension written in Rust. The main purpose of this library is to allow working with spreadsheets from SQLite exposing them as virtual tables.

How to build

cargo build --release

This step will produce libxlite.so or libxlite.dylib depending on your operation system.

How to use

Assuming you have sqlite3 command line tools installed, libxlite library in your current directory and some spreadsheet file on your disk (this sample uses an .xslx file exported from Google Sheets) load extension:

sqlite3 # will open SQLite CLI
> .load libxlite

This will load xlite module, now it can be used to create virtual tables.

Creating a virtual table:

CREATE VIRTUAL TABLE class_data USING xlite(
    FILENAME './path/to/example.xlsx',
    WORKSHEET 'Class Data',
    RANGE 'A2:F'
);

Explanation: this statement will create a virtual table based on the .xlsx file and the worksheet named "Class Data".

Optional RANGE parameter is used here to skip the first row in the table because in the sample spreadsheet it is used as a header. A2:F meaning is use columns from A to F but start from 2nd row.

Querying:

SELECT A, B, C, D, E, F from class_data;

Columns are named according to their name (index) in the spreadsheet.

SELECT COUNT(*), D FROM class_data GROUP BY D ORDER BY COUNT(*);

Theoretically any operation supported by SQLite can be executed on the spreadsheet as long as it is supported by the virtual table mechanism.

Dropping:

DROP TABLE class_data;

This statement will drop only the virtual table. Physical file won't be deleted.

Limitations

INSERT, UPDATE and DELETE statements are not supported right now.

About

This project is experimental, use at your own risk. The project is developed in my free time as a way to learn Rust and database systems.

xlite's People

Contributors

x2bool avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.