mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 06:29:07 +00:00
Improve xlsx import (#1271)
* use xlsx * add existing custom fields to import map * keep colours of existing custom fields * use unknown * fix * revert * allow space and upper case * fix test * define empty sheet
This commit is contained in:
committed by
GitHub
parent
59c1c77d48
commit
42984eed87
@@ -15,6 +15,7 @@ import { parseExcel } from '../../utils/parser.js';
|
||||
import { logger } from '../../classes/Logger.js';
|
||||
import { parseRundown } from '../../utils/parserFunctions.js';
|
||||
import { getRundown } from '../rundown-service/rundownUtils.js';
|
||||
import { getCustomFields } from '../rundown-service/rundownCache.js';
|
||||
|
||||
import { cellRequestFromEvent, type ClientSecret, getA1Notation, validateClientSecret } from './sheetUtils.js';
|
||||
|
||||
@@ -286,7 +287,7 @@ export async function upload(sheetId: string, options: ImportMap) {
|
||||
throw new Error(`Sheet read failed: ${readResponse.statusText}`);
|
||||
}
|
||||
|
||||
const { rundownMetadata } = parseExcel(readResponse.data.values, options);
|
||||
const { rundownMetadata } = parseExcel(readResponse.data.values, getCustomFields(), options);
|
||||
const rundown = getRundown();
|
||||
const titleRow = Object.values(rundownMetadata)[0]['row'];
|
||||
const updateRundown = Array<sheets_v4.Schema$Request>();
|
||||
@@ -363,7 +364,7 @@ export async function download(
|
||||
throw new Error(`Sheet read failed: ${googleResponse.statusText}`);
|
||||
}
|
||||
|
||||
const dataFromSheet = parseExcel(googleResponse.data.values, options);
|
||||
const dataFromSheet = parseExcel(googleResponse.data.values, getCustomFields(), options);
|
||||
const { customFields, rundown } = parseRundown(dataFromSheet);
|
||||
if (rundown.length < 1) {
|
||||
throw new Error('Sheet: Could not find data to import in the worksheet');
|
||||
|
||||
Reference in New Issue
Block a user