first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as fromFile from '../../../SpreadsheetFile/v2/fromFile.operation';
|
||||
|
||||
export const operations = ['csv', 'html', 'rtf', 'ods', 'xls', 'xlsx'];
|
||||
|
||||
export const description: INodeProperties[] = fromFile.description
|
||||
.filter((property) => property.name !== 'fileFormat')
|
||||
.map((property) => {
|
||||
const newProperty = { ...property };
|
||||
newProperty.displayOptions = {
|
||||
show: {
|
||||
operation: operations,
|
||||
},
|
||||
};
|
||||
|
||||
if (newProperty.name === 'options') {
|
||||
newProperty.options = (newProperty.options as INodeProperties[]).map((option) => {
|
||||
let newOption = option;
|
||||
if (
|
||||
[
|
||||
'delimiter',
|
||||
'encoding',
|
||||
'fromLine',
|
||||
'maxRowCount',
|
||||
'enableBOM',
|
||||
'relaxQuotes',
|
||||
'skipRecordsWithErrors',
|
||||
].includes(option.name)
|
||||
) {
|
||||
newOption = { ...option, displayOptions: { show: { '/operation': ['csv'] } } };
|
||||
}
|
||||
if (option.name === 'sheetName') {
|
||||
newOption = {
|
||||
...option,
|
||||
displayOptions: { show: { '/operation': ['ods', 'xls', 'xlsx'] } },
|
||||
description: 'Name of the sheet to read from in the spreadsheet',
|
||||
};
|
||||
}
|
||||
if (option.name === 'range') {
|
||||
newOption = {
|
||||
...option,
|
||||
displayOptions: { show: { '/operation': ['ods', 'xls', 'xlsx'] } },
|
||||
};
|
||||
}
|
||||
if (['includeEmptyCells', 'headerRow'].includes(option.name)) {
|
||||
newOption = {
|
||||
...option,
|
||||
displayOptions: { show: { '/operation': ['ods', 'xls', 'xlsx', 'csv', 'html'] } },
|
||||
};
|
||||
}
|
||||
return newOption;
|
||||
});
|
||||
}
|
||||
return newProperty;
|
||||
});
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
items: INodeExecutionData[],
|
||||
fileFormatProperty: string,
|
||||
options?: fromFile.FromFileOptions,
|
||||
) {
|
||||
const returnData: INodeExecutionData[] = await fromFile.execute.call(
|
||||
this,
|
||||
items,
|
||||
fileFormatProperty,
|
||||
options,
|
||||
);
|
||||
return returnData;
|
||||
}
|
||||
Reference in New Issue
Block a user