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
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
|
|
|
import { wrapData } from '../../../../../../utils/utilities';
|
|
import type { GoogleSheet } from '../../helpers/GoogleSheet';
|
|
import { apiRequest } from '../../transport';
|
|
|
|
export async function execute(
|
|
this: IExecuteFunctions,
|
|
_sheet: GoogleSheet,
|
|
sheetName: string,
|
|
): Promise<INodeExecutionData[]> {
|
|
const returnData: INodeExecutionData[] = [];
|
|
const items = this.getInputData();
|
|
for (let i = 0; i < items.length; i++) {
|
|
const [spreadsheetId, sheetWithinDocument] = sheetName.split('||');
|
|
const requests = [
|
|
{
|
|
deleteSheet: {
|
|
sheetId: sheetWithinDocument,
|
|
},
|
|
},
|
|
];
|
|
|
|
const responseData = await apiRequest.call(
|
|
this,
|
|
'POST',
|
|
`/v4/spreadsheets/${spreadsheetId}:batchUpdate`,
|
|
{ requests },
|
|
);
|
|
delete responseData.replies;
|
|
|
|
const executionData = this.helpers.constructExecutionMetaData(
|
|
wrapData(responseData as IDataObject[]),
|
|
{ itemData: { item: i } },
|
|
);
|
|
|
|
returnData.push(...executionData);
|
|
}
|
|
|
|
return returnData;
|
|
}
|