-
Notifications
You must be signed in to change notification settings - Fork 0
Add Excel Driver with ExcelJS (secure, no CVEs) - with flexible storage modes #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b169a71
f19a93d
29b1aea
3476661
1685b6d
e32c1a1
6fb1777
99b0ad6
892e2eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Generated Excel files | ||
| data/**/*.xlsx | ||
| data/**/*.xls | ||
| data/ | ||
|
|
||
| # Build output | ||
| dist/ | ||
|
|
||
| # Dependencies | ||
| node_modules/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Excel Driver Demo | ||
|
|
||
| This example demonstrates the Excel Driver for ObjectQL. | ||
|
|
||
| ## Installation | ||
|
|
||
| From the repository root: | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| ``` | ||
|
|
||
| ## Running the Demo | ||
|
|
||
| ```bash | ||
| cd examples/drivers/excel-demo | ||
| pnpm start | ||
| ``` | ||
|
|
||
| ## What This Demo Shows | ||
|
|
||
| 1. **Creating Records** - Add users and products to Excel | ||
| 2. **Querying Data** - Filter, sort, search, and paginate | ||
| 3. **Updating Records** - Modify individual and bulk records | ||
| 4. **Deleting Records** - Remove records from Excel | ||
| 5. **Multiple Worksheets** - Separate sheets for different object types | ||
| 6. **Bulk Operations** - Create multiple records at once | ||
|
|
||
| ## Output | ||
|
|
||
| The demo will: | ||
| - Create an Excel file at `data/demo.xlsx` | ||
| - Populate it with sample users and products | ||
| - Demonstrate various query operations | ||
| - Show the final state of the data | ||
|
|
||
| ## Excel File Structure | ||
|
|
||
| After running, `data/demo.xlsx` will contain: | ||
|
|
||
| **Sheet: users** | ||
| | id | name | email | role | age | department | created_at | updated_at | | ||
| |----|------|-------|------|-----|------------|------------|------------| | ||
| | ... | Alice Johnson | alice.johnson@... | admin | 31 | Tech | ... | ... | | ||
|
|
||
| **Sheet: products** | ||
| | id | name | price | category | stock | created_at | updated_at | | ||
| |----|------|-------|----------|-------|------------|------------| | ||
| | ... | Laptop Pro | 1299.99 | Electronics | 50 | ... | ... | | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - Modify `src/index.ts` to experiment with different queries | ||
| - Try adding your own object types | ||
| - Explore filter operators and sorting options | ||
| - Check the [Excel Driver README](../../../packages/drivers/excel/README.md) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "name": "@objectql/example-excel-demo", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "description": "Example demonstrating the Excel Driver for ObjectQL", | ||
| "scripts": { | ||
| "start": "ts-node src/index.ts", | ||
| "build": "tsc" | ||
| }, | ||
| "dependencies": { | ||
| "@objectql/driver-excel": "workspace:*", | ||
| "@objectql/types": "workspace:*" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^20.10.0", | ||
| "ts-node": "^10.9.0", | ||
| "typescript": "^5.0.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,277 @@ | ||||||||||||||
| /** | ||||||||||||||
| * Excel Driver Demo | ||||||||||||||
| * | ||||||||||||||
| * This example demonstrates both storage modes of the Excel Driver for ObjectQL: | ||||||||||||||
| * 1. Single-file mode (default): All data in one Excel file | ||||||||||||||
| * 2. File-per-object mode: Each object type in its own file | ||||||||||||||
| */ | ||||||||||||||
|
|
||||||||||||||
| import { ExcelDriver } from '@objectql/driver-excel'; | ||||||||||||||
| import * as path from 'path'; | ||||||||||||||
|
|
||||||||||||||
| async function demoFilePerObjectMode() { | ||||||||||||||
| console.log('=' .repeat(60)); | ||||||||||||||
| console.log('📂 FILE-PER-OBJECT MODE DEMO'); | ||||||||||||||
| console.log('=' .repeat(60) + '\n'); | ||||||||||||||
|
Comment on lines
+13
to
+15
|
||||||||||||||
| console.log('=' .repeat(60)); | |
| console.log('📂 FILE-PER-OBJECT MODE DEMO'); | |
| console.log('=' .repeat(60) + '\n'); | |
| console.log('='.repeat(60)); | |
| console.log('📂 FILE-PER-OBJECT MODE DEMO'); | |
| console.log('='.repeat(60) + '\n'); |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space between '=' and .repeat(60). This should be '='.repeat(60) without the space.
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space between '=' and .repeat(60). This should be '='.repeat(60) without the space.
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space between '=' and .repeat(60). This should be '='.repeat(60) without the space.
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space between '=' and .repeat(60). This should be '='.repeat(60) without the space.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "extends": "../../../tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "outDir": "./dist", | ||
| "rootDir": "./src" | ||
| }, | ||
| "include": ["src/**/*"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space between '=' and .repeat(60). This should be '='.repeat(60) without the space.