https://github.com/fugerit-org/query-export-tool
Tool export query in CSV and XLS / XLSX format
https://github.com/fugerit-org/query-export-tool
csv export query tool xls xlsx
Last synced: 3 months ago
JSON representation
Tool export query in CSV and XLS / XLSX format
- Host: GitHub
- URL: https://github.com/fugerit-org/query-export-tool
- Owner: fugerit-org
- License: apache-2.0
- Created: 2019-06-08T09:29:18.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-12-14T23:33:41.000Z (7 months ago)
- Last Synced: 2025-03-22T09:08:16.635Z (4 months ago)
- Topics: csv, export, query, tool, xls, xlsx
- Language: Java
- Homepage:
- Size: 124 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# query-export-tool
Tool export query in CSV and XLS / XLSX format
[](CHANGELOG.md)
[](https://mvnrepository.com/artifact/org.fugerit.java/query-export-tool)
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/fugerit-org/fj-universe/blob/main/CODE_OF_CONDUCT.md)
[](https://sonarcloud.io/summary/new_code?id=fugerit-org_query-export-tool)
[](https://sonarcloud.io/summary/new_code?id=fugerit-org_query-export-tool)

## 1 Quickstart
### 1.1 Create a sample query catalog
```
```
### 1.2 Load and use the catalog
```
QueryConfigCatalog catalog = QueryConfigCatalog.loadQueryConfigCatalogSafe( "cl://sample/query-catalog-sample.xml" );
try ( Connection conn = ... ) {
catalog.handle( conn , "main-catalog", "Q001");
}
```## 2 Formats
### 2.1 HTML format
HTML format is handled with core I/O API, no dependency needed.
### 2.2 CSV format
CSV Format needs *OpenCSV* dependency, which is automatically included by default when importing query-export-tool dependency.
If needed it can be added in explicit way :
```
com.opencsv
opencsv
${opencsv-version}
```### 2.3 XLS/XLSX formats
XLS/XLSX Formats needs *Apache POI* dependency, which is *NOT* automatically included by default when importing query-export-tool dependency :
```
org.apache.poi
poi-ooxml
${poi-version}
```## 3 Usage As SQL Catalog
Create the xml catalog :
```xml
SELECT * FROM test_export
```
Access the catalog :
```java
QueryConfigCatalog catalog = QueryConfigCatalog.loadQueryConfigCatalogSafe("cl://sample/query-catalog-sample-alt.xml");
QueryConfig queryConfig = catalog.getListMap( "sample-catalog-alt" ).get( "Q001ALT" );
logger.info( "query config : {}, sql : {}", queryConfig, queryConfig.getSql() );
```A full example is available in the [JUNIT](src/test/java/test/org/fugerit/java/query/export/tool/TestCatalogAlt.java) .