mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
feat(Google Sheets Node): Overhaul of node
This commit is contained in:
committed by
GitHub
parent
6eee155ecb
commit
d96d6f11db
@@ -0,0 +1,36 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
import { apiRequest } from '../../transport';
|
||||
import { 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,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
let responseData;
|
||||
|
||||
responseData = await apiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/v4/spreadsheets/${spreadsheetId}:batchUpdate`,
|
||||
{ requests },
|
||||
);
|
||||
delete responseData.replies;
|
||||
returnData.push(responseData);
|
||||
}
|
||||
|
||||
return this.helpers.returnJsonArray(returnData);
|
||||
}
|
||||
Reference in New Issue
Block a user