mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 04:16:00 +00:00
using xlsx lib instead of exceljs, export excel files
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { DatabaseInfo } from 'dbgate-types';
|
||||
import axios from '../utility/axios';
|
||||
import fileFormatBase from './fileFormatBase';
|
||||
import { FileFormatDefinition } from './types';
|
||||
@@ -9,16 +8,16 @@ const excelFormat: FileFormatDefinition = {
|
||||
extension: 'xlsx',
|
||||
name: 'MS Excel',
|
||||
readerFunc: 'excelSheetReader',
|
||||
writerFunc: 'excelSheetWriter',
|
||||
|
||||
addFilesToSourceList: async (file, newSources, newValues) => {
|
||||
const resp = await axios.get(`files/analyse-excel?filePath=${encodeURIComponent(file.full)}`);
|
||||
const structure: DatabaseInfo = resp.data;
|
||||
for (const table of structure.tables) {
|
||||
const sourceName = table.pureName;
|
||||
newSources.push(sourceName);
|
||||
newValues[`sourceFile_${sourceName}`] = {
|
||||
const sheetNames = resp.data;
|
||||
for (const sheetName of sheetNames) {
|
||||
newSources.push(sheetName);
|
||||
newValues[`sourceFile_${sheetName}`] = {
|
||||
fileName: file.full,
|
||||
sheetName: table.pureName,
|
||||
sheetName,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user