AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction } from "@activepieces/pieces-framework";
import { areSheetIdsValid, googleSheetsAuth, googleSheetsCommon, mapRowsToHeaderNames } from "../common/common";
import { commonProps, isFirstRowHeaderProp } from "../common/props";
import { getManyRowsActionOutputSchema } from '../output-schemas';
export const getManyRowsAction = createAction({
name: 'get-many-rows',
classification: 'SEARCH',
auth: googleSheetsAuth,
displayName: 'Get All Rows',
description: 'Read every row from a worksheet.',
audience: 'human',
aiMetadata: {
description:
'Reads every row from a worksheet in a single call, optionally keyed by header names. Use when an agent needs the full contents of a sheet rather than a search or a single row; be mindful of size on large sheets. Read-only and idempotent.',
idempotent: true,
},
props: {
...commonProps,
first_row_headers: isFirstRowHeaderProp()
},
outputSchema: getManyRowsActionOutputSchema,
async run(context) {
const {first_row_headers,sheetId,spreadsheetId} = context.propsValue;
if (!areSheetIdsValid(spreadsheetId, sheetId)) {
throw new Error('Please select a spreadsheet and sheet first.');
}
const rows = await googleSheetsCommon.getGoogleSheetRows({
auth:context.auth,
sheetId: sheetId as number,
spreadsheetId: spreadsheetId as string,
rowIndex_s: first_row_headers ? 2 : undefined,
rowIndex_e:undefined,
headerRow: 1,
});
const useHeaderNames = first_row_headers ?? false;
const result = await mapRowsToHeaderNames(
rows,
useHeaderNames,
spreadsheetId as string,
sheetId as number,
1,
context.auth
)
return result
}
})