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)
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.0.tar.gz
(2.7 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.0.tar.gz.
File metadata
- Download URL: exlsql-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1587fcc22a4a1d20009586c3023a01f1da168ee828b0d70cae0374c392e8d854
|
|
| MD5 |
986c359d32c8ffdd855cb3fc5992d6cf
|
|
| BLAKE2b-256 |
8b8dbe3979884c86fa85ed41f4ccb263bebc16b8a2385d73efdfaa5c26d3db78
|
File details
Details for the file exlsql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: exlsql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.9 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 |
abe46bcf1c2b33f639b7787a86385850d9b28ccdfbbb899da7a47e64041c4cde
|
|
| MD5 |
e17540694d3ffb710537d12b8ade785d
|
|
| BLAKE2b-256 |
8e54a72f4aeee3ff666dac9f913e9067304780442631ce4cfe9f9fad3dd386e4
|