1- # SQL2Excel - SQL 쿼리 결과를 엑셀 파일로 생성
1+ # SQL2Excel - Generate Excel Files from SQL Query Results
22
3- SQL 쿼리 결과를 엑셀 파일로 생성하는 Node.js 기반 도구입니다 .
3+ A Node.js-based tool for generating Excel files from SQL query results .
44
5- ## 🎯 주요 기능
5+ ## 🎯 Key Features
66
7- - 📊 ** 멀티 시트 지원 ** : 여러 SQL 쿼리 결과를 하나의 엑셀 파일에 시트별로 저장
8- - 🎨 ** 엑셀 스타일링 ** : 헤더/데이터 영역 각각 폰트, 색상, 테두리, 정렬 등 세부 스타일 설정
9- - 🔗 ** 다중 DB 연결 ** : 시트별로 다른 데이터베이스 연결 가능
10- - 📝 ** 변수 시스템 ** : 쿼리 내 변수 사용으로 동적 쿼리 생성
11- - 🔄 ** 동적 변수 ** : 데이터베이스에서 실시간으로 값을 조회하여 동적 쿼리 생성
12- - 🔄 ** 쿼리 재사용 ** : 공통 쿼리 정의 후 여러 시트에서 재사용
13- - 📋 ** 자동 목차 ** : 목차 시트 자동 생성 및 하이퍼링크 제공
14- - 📊 ** 집계 기능 ** : 지정 컬럼의 값별 건수 자동 집계 및 표시
15- - 🚦 ** 조회 제한 ** : 대용량 데이터 처리를 위한 건수 제한 기능
16- - 🖥️ ** CLI 인터페이스 ** : 명령줄 도구로 간편한 실행
17- - 🪟 ** 윈도우 배치 파일 ** : 윈도우 사용자를 위한 배치 파일 제공
18- - 📄 ** XML/JSON 지원 ** : 유연한 설정 파일 형식 지원
7+ - 📊 ** Multi-Sheet Support ** : Save multiple SQL query results in separate sheets within one Excel file
8+ - 🎨 ** Excel Styling ** : Detailed styling for header/data areas including fonts, colors, borders, alignment
9+ - 🔗 ** Multiple DB Connections ** : Use different database connections for each sheet
10+ - 📝 ** Variable System ** : Use variables in queries for dynamic query generation
11+ - 🔄 ** Dynamic Variables ** : Extract values from database in real-time for dynamic query generation
12+ - 🔄 ** Query Reuse ** : Define common queries and reuse them across multiple sheets
13+ - 📋 ** Auto Table of Contents ** : Automatically generate table of contents sheet with hyperlinks
14+ - 📊 ** Aggregation Features ** : Automatic aggregation and display of counts by specified column values
15+ - 🚦 ** Query Limits ** : Row count limiting for large data processing
16+ - 🖥️ ** CLI Interface ** : Simple command-line tool execution
17+ - 🪟 ** Windows Batch Files ** : Batch files for Windows users
18+ - 📄 ** XML/JSON Support ** : Flexible configuration file format support
1919
20- ## 🚀 빠른 시작
20+ ## 🚀 Quick Start
2121
22- ### 1. 설치
22+ ### 1. Installation
2323``` bash
2424npm install
2525```
2626
27- ### 2. 데이터베이스 설정
28- ` config/dbinfo.json ` 파일에 데이터베이스 연결 정보 설정 :
27+ ### 2. Database Configuration
28+ Configure database connection information in ` config/dbinfo.json ` :
2929``` json
3030{
3131 "dbs" : {
@@ -44,69 +44,69 @@ npm install
4444}
4545```
4646
47- ### 3. 엑셀 파일 생성
47+ ### 3. Generate Excel File
4848``` bash
49- # CLI 명령어로 실행
49+ # Execute via CLI command
5050node src/excel-cli.js export --xml ./queries/queries-sample.xml
5151
52- # 또는 NPM 스크립트로 실행
52+ # Or execute via NPM script
5353npm run export -- --xml ./queries/queries-sample.xml
5454
55- # 또는 윈도우 배치 파일로 실행
55+ # Or execute via Windows batch file
5656실행하기.bat
5757```
5858
59- ### 4. 주요 CLI 명령어
59+ ### 4. Main CLI Commands
6060``` bash
61- # 엑셀 파일 생성
61+ # Generate Excel file
6262node src/excel-cli.js export --xml ./queries/sample.xml
6363
64- # 쿼리 파일 검증
64+ # Validate query file
6565node src/excel-cli.js validate --xml ./queries/sample.xml
6666
67- # 데이터베이스 연결 테스트
67+ # Test database connection
6868node src/excel-cli.js list-dbs
6969
70- # 도움말
70+ # Help
7171node src/excel-cli.js help
7272```
7373
74- ## 📚 문서
74+ ## 📚 Documentation
7575
76- 상세한 사용법과 고급 기능은 다음 문서를 참조하세요 :
76+ For detailed usage and advanced features, refer to the following documents :
7777
78- - ** 📖 [ 사용자 매뉴얼 ] ( USER_MANUAL.md ) ** - 완전한 사용 가이드
79- - ** 📋 [ 버전 히스토리 ] ( CHANGELOG.md ) ** - 버전별 변경사항
78+ - ** 📖 [ User Manual ] ( USER_MANUAL.md ) ** - Complete usage guide
79+ - ** 📋 [ Version History ] ( CHANGELOG.md ) ** - Version-specific changes
8080
81- ## 💡 사용 예시
81+ ## 💡 Usage Examples
8282
83- ### XML 설정 파일 예시 (동적 변수 포함 )
83+ ### XML Configuration File Example (with Dynamic Variables )
8484``` xml
8585<queries >
86- <excel db =" sampleDB" output =" output/매출보고서 .xlsx" >
86+ <excel db =" sampleDB" output =" output/SalesReport .xlsx" >
8787 <header >
88- <font name =" 맑은 고딕 " size =" 12" color =" FFFFFF" bold =" true" />
88+ <font name =" Arial " size =" 12" color =" FFFFFF" bold =" true" />
8989 <fill color =" 4F81BD" />
9090 </header >
9191 </excel >
9292
93- <!-- 일반 변수 -->
93+ <!-- Regular variables -->
9494 <vars >
9595 <var name =" startDate" >2024-01-01</var >
9696 <var name =" endDate" >2024-12-31</var >
9797 </vars >
9898
99- <!-- 동적 변수 -->
100- <dynamicVars >
101- <dynamicVar name =" activeCustomers" description =" 활성 고객 목록 " >
102- <![CDATA[
103- SELECT CustomerID, CustomerName, Region
104- FROM Customers WHERE IsActive = 1
105- ]]>
106- </dynamicVar >
107- </dynamicVars >
99+ <!-- Dynamic variables -->
100+ <dynamicVars >
101+ <dynamicVar name =" activeCustomers" description =" Active customer list " >
102+ <![CDATA[
103+ SELECT CustomerID, CustomerName, Region
104+ FROM Customers WHERE IsActive = 1
105+ ]]>
106+ </dynamicVar >
107+ </dynamicVars >
108108
109- <sheet name =" 월별매출 " use =" true" aggregateColumn =" Month" >
109+ <sheet name =" MonthlySales " use =" true" aggregateColumn =" Month" >
110110 <![CDATA[
111111 SELECT MONTH(OrderDate) as Month, SUM(TotalAmount) as Sales
112112 FROM Orders
@@ -118,24 +118,87 @@ node src/excel-cli.js help
118118</queries >
119119```
120120
121- ### 변수 사용 예시
121+ ### Variable Usage Example
122122``` bash
123123node src/excel-cli.js export --xml ./queries/sales-report.xml \
124124 --var " startDate=2024-01-01" \
125125 --var " endDate=2024-06-30"
126126```
127127
128- ## 🔧 환경 요구사항
128+ ## Dynamic Variables
129129
130- - Node.js 16.0 이상
131- - SQL Server 2012 이상
132- - 적절한 데이터베이스 권한
130+ The tool supports dynamic variables that can extract data at runtime and use it in queries:
133131
134- ## 📞 지원
132+ ### Variable Types
135133
136- - ** 웹사이트** : sql2excel.com
137- - ** 이메일** : sql2excel.nodejs@gmail.com
134+ | Type | Description | Access Pattern | Default |
135+ | ------| -------------| ----------------| ---------|
136+ | ` column_identified ` | Extract all columns as arrays keyed by column name | ` ${varName.columnName} ` | ✅ Yes |
137+ | ` key_value_pairs ` | Extract first two columns as key-value pairs | ` ${varName.key} ` | No |
138+
139+ ### Usage Examples
140+
141+ ``` xml
142+ <!-- Using column_identified (default) -->
143+ <dynamicVar name =" customerData" description =" Customer information" >
144+ <![CDATA[
145+ SELECT CustomerID, CustomerName, Region FROM Customers
146+ ]]>
147+ <!-- type omitted - defaults to column_identified -->
148+ </dynamicVar >
149+
150+ <!-- Using key_value_pairs -->
151+ <dynamicVar name =" statusMapping" description =" Status mapping" >
152+ <![CDATA[
153+ SELECT StatusCode, StatusName FROM StatusCodes
154+ ]]>
155+ <type >key_value_pairs</type >
156+ </dynamicVar >
157+ ```
158+
159+ ``` sql
160+ -- In your sheet queries
161+ SELECT * FROM Orders
162+ WHERE CustomerID IN (${customerData .CustomerID })
163+ AND Status IN (${statusMapping .StatusCode })
164+ ```
165+
166+ ## 🔧 Environment Requirements
167+
168+ - Node.js 16.0 or higher
169+ - SQL Server 2012 or higher
170+ - Appropriate database permissions
171+
172+ ## 📞 Support
173+
174+ - ** Website** : sql2excel.com
175+ - ** Email** : sql2excel.nodejs@gmail.com
176+
177+
178+ ## License
179+
180+ MIT License
181+
182+ Copyright (c) 2024 MSSQL Data Migration Tool
183+
184+ Permission is hereby granted, free of charge, to any person obtaining a copy
185+ of this software and associated documentation files (the "Software"), to deal
186+ in the Software without restriction, including without limitation the rights
187+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
188+ copies of the Software, and to permit persons to whom the Software is
189+ furnished to do so, subject to the following conditions:
190+
191+ The above copyright notice and this permission notice shall be included in all
192+ copies or substantial portions of the Software.
193+
194+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
195+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
196+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
197+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
198+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
199+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
200+ SOFTWARE.
138201
139202---
140203
141- ** 버전 ** : v1.2.2 | ** 최종 업데이트 ** : 2025-08-20
204+ ** Version ** : v1.2.2 | ** Last Updated ** : 2025-08-20
0 commit comments