mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 11:26:00 +00:00
added plugins
This commit is contained in:
52
plugins/dbgate-plugin-excel/README.md
Normal file
52
plugins/dbgate-plugin-excel/README.md
Normal file
@@ -0,0 +1,52 @@
|
||||
[](https://github.com/prettier/prettier)
|
||||
[](https://paypal.me/JanProchazkaCz/30eur)
|
||||
[](https://www.npmjs.com/package/dbgate-plugin-excel)
|
||||
|
||||
# dbgate-plugin-excel
|
||||
|
||||
MS Excel import/export plugin for DbGate
|
||||
|
||||
|
||||
## Usage without DbGate
|
||||
|
||||
Export from fake object reader into MS Excel file. Fake object file can be replaced with other reader/writer factory functions, as described in
|
||||
[dbgate-api package](https://www.npmjs.com/package/dbgate-api)
|
||||
|
||||
```javascript
|
||||
const dbgateApi = require('dbgate-api');
|
||||
const dbgatePluginExcel = require("dbgate-plugin-excel");
|
||||
|
||||
dbgateApi.registerPlugins(dbgatePluginExcel);
|
||||
|
||||
|
||||
async function run() {
|
||||
const reader = await dbgateApi.fakeObjectReader();
|
||||
const writer = await dbgatePluginExcel.shellApi.writer({ fileName: 'myfile1.xlsx', sheetName: 'Sheet 1' });
|
||||
await dbgateApi.copyStream(reader, writer);
|
||||
console.log('Finished job script');
|
||||
}
|
||||
dbgateApi.runScript(run);
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Factory functions
|
||||
|
||||
### shellApi.reader
|
||||
Reads tabular data from one sheet in MS Excel file.
|
||||
```js
|
||||
const reader = await dbgatePluginExcel.shellApi.reader({
|
||||
fileName: 'test.xlsx',
|
||||
sheetName: 'Album',
|
||||
limitRows: null
|
||||
});
|
||||
```
|
||||
|
||||
### shellApi.writer
|
||||
Writes tabular data into MS excel file. There could be more writes into the some file in one script, if property sheetName is different.
|
||||
```js
|
||||
const reader = await dbgatePluginExcel.shellApi.writer({
|
||||
fileName: 'test.xlsx',
|
||||
sheetName: 'Album',
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user