dbgate/plugins/dbgate-plugin-excel
2021-12-22 10:59:00 +01:00
..
src complete removed axiosInstance 2021-12-22 10:59:00 +01:00
icon.svg added plugins 2021-04-13 16:17:53 +02:00
LICENSE added plugins 2021-04-13 16:17:53 +02:00
package.json Bump lodash from 4.17.15 to 4.17.21 2021-05-16 12:00:59 +00:00
prettier.config.js added plugins 2021-04-13 16:17:53 +02:00
README.md removed paypal links 2021-04-19 17:55:16 +02:00
webpack-backend.config.js added plugins 2021-04-13 16:17:53 +02:00
webpack-frontend.config.js one more optimalization of plugin size & load time 2021-05-20 08:55:50 +02:00

styled with prettier NPM version

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

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.

  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.

  const reader = await dbgatePluginExcel.shellApi.writer({
    fileName: 'test.xlsx',
    sheetName: 'Album',
  });