SQL-like queries for Excel files
Project description
exlsql
Query Excel files using SQL syntax. Pass a SQL string and an .xlsx file — get a filtered, queried Excel file back.
Installation
pip install exlsql
Usage
from exlsql import Query
q = Query("SELECT name, age FROM Sheet1 WHERE age > 30", excel_file="data.xlsx")
parsed = q.parse()
output = q.to_excel(parsed, type="dict")
print(output) # data_output.xlsx
Supported Syntax
| Feature | Example |
|---|---|
| Select columns | SELECT name, age FROM Sheet1 |
| Select all | SELECT * FROM Sheet1 |
| Filter rows | WHERE age > 30 |
| Multiple conditions | WHERE age > 30 AND city = 'Lagos' |
| Column names with spaces | SELECT "first name" FROM Sheet1 |
Notes
FROMrefers to the sheet name inside the Excel file- Only
.xlsxfiles are supported - The output is written to a new file — e.g.
data.xlsx→data_output.xlsx - String values in
WHEREmust be wrapped in single quotes:city = 'New York'
Requirements
- pandas
- openpyxl
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
exlsql-0.1.1.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exlsql-0.1.1.tar.gz.
File metadata
- Download URL: exlsql-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28e2e7a130b9df8fe5a073c66a47d231e71fbcdd4b7c2900adaf0f6299985608
|
|
| MD5 |
f232db9f9451752531a4a1cb317fb7cd
|
|
| BLAKE2b-256 |
c821150c5e064d8048fc4e7042cdb9148780d3402b27969c4cd024a02c1a8c13
|
File details
Details for the file exlsql-0.1.1-py3-none-any.whl.
File metadata
- Download URL: exlsql-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34ba62ee17235a4eb596e254826311d85ce7edf6fc2861a0472f4f5815455b6c
|
|
| MD5 |
6f2374ad6e832c56cdf45cde66870c45
|
|
| BLAKE2b-256 |
a4f63573bdb02b8cdfe902ae37320247d618f2b152a3b13cbf87d7b34f884793
|