* 👕 Enable `consistent-type-imports` for nodes-base * 👕 Apply to nodes-base * ⏪ Undo unrelated changes * 🚚 Move to `.eslintrc.js` in nodes-base * ⏪ Revert "Enable `consistent-type-imports` for nodes-base" This reverts commit 529ad72b051478fa1633aaf84b2864f2fdc7613c. * 👕 Fix severity
35 lines
908 B
TypeScript
35 lines
908 B
TypeScript
import type { IExecuteFunctions } from 'n8n-core';
|
|
import type { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
|
import { apiRequest } from '../../transport';
|
|
import type { GoogleSheet } from '../../helpers/GoogleSheet';
|
|
|
|
export async function execute(
|
|
this: IExecuteFunctions,
|
|
sheet: GoogleSheet,
|
|
sheetName: string,
|
|
): Promise<INodeExecutionData[]> {
|
|
const returnData: IDataObject[] = [];
|
|
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;
|
|
returnData.push(responseData);
|
|
}
|
|
|
|
return this.helpers.returnJsonArray(returnData);
|
|
}
|