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.2.tar.gz
(3.3 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.2.tar.gz.
File metadata
- Download URL: exlsql-0.1.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9a3c797edb1a9ebb5b22ddf81adbde784409e5cbdba30cf97f4443b03f29ea7
|
|
| MD5 |
be8e0103c1020963671fc3d74bef2a25
|
|
| BLAKE2b-256 |
d294dc89bf1300a39e937977904d5004f65e429af763f547c3991b72c9227802
|
File details
Details for the file exlsql-0.1.2-py3-none-any.whl.
File metadata
- Download URL: exlsql-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.6 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 |
ad645076ff83389e1aa636206ad2a943903ed2b78c195614fceb355dbedfd763
|
|
| MD5 |
8c9434c298404f5db1d3580a5fa69ab1
|
|
| BLAKE2b-256 |
f111441d71668f0c71f2ca86cbd135b421c751322818e732a06f59e4a9cb4b4f
|