← All N8N workflows
AI & researchChain LLMCodeExtract From FileGmailGoogle Drive

Amazon Ads AI Optimization

Configured with Chain LLM, Extract From File, Gmail, Google Drive, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
Files / mediaList FilesGoogle DriveAI & modelsOpenAI Chat ModelOpenAI Chat ModelRoutingis XLSXIfFiles / mediaGet FileGoogle DriveTransformMerge XLSX and CSVMergeCodeFormat DataCodeTransformSet fileNameEdit FieldsTransformPreserve File NameEdit FieldsMessagingEmail OptimizationsGmailTransformExtract XLSX DataExtract From FileTransformExtract CSV DataExtract From FileTransformPreserve CSV File NameEdit FieldsTriggerWhen clicking ‘Testworkflow’Manual TriggerTransformEmail OptionsEdit FieldsAI & modelsAI AnalyzeChain LLM

Node categories in this workflow

  • Files / media
  • AI & models
  • Routing
  • Transform
  • Code
  • Messaging
  • Trigger

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
List FilesFiles / mediaGoogle DrivefileFolder
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
is XLSXRoutingIfSee node parameters
Get FileFiles / mediaGoogle Drivedownload
Merge XLSX and CSVTransformMergeSee node parameters
Format DataCodeCodeSee node parameters
Set fileNameTransformEdit FieldsSee node parameters
Preserve File NameTransformEdit FieldsSee node parameters
Email OptimizationsMessagingGmailSee node parameters
Extract XLSX DataTransformExtract From Filexlsx
Extract CSV DataTransformExtract From FileSee node parameters
Preserve CSV File NameTransformEdit FieldsSee node parameters
When clicking ‘Test workflow’TriggerManual TriggerSee node parameters
Email OptionsTransformEdit FieldsSee node parameters
AI AnalyzeAI & modelsChain LLMSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • gmailOAuth2
  • googleDriveOAuth2Api
  • openAiApi

Workflow notes

Change

Change

Choose the "folder" in the filter options to the folder containing your Ad reports

AI Analysis

AI Analysis

Uses GPT-4o to process the bundled reports and generate optimization instructions. Passes system instructions and cleaned data as input.

Amazon Ads Report Scheduling Instructions

Amazon Ads Report Scheduling Instructions

To run this workflow, schedule the following Sponsored Products reports in the Amazon Ads Console:

Use "Detailed" for:

Search Term Report → Sponsored_Products_Search_Term_Detailed_L30

Targeting Report → Sponsored_Products_Targeting_Detailed_L30

Use "Summary" for:

Campaign Report → Sponsored_Products_Campaign_L30

Placement Report → Sponsored_Products_Placement_L30

Budget Report → Sponsored_Products_Budget_L30

Shared settings for all reports:

Date Range: Last 30 Days

Frequency: Daily

Format: .xlsx or .csv

Delivery: Email + Console Download

Make sure filenames match expectations so the workflow can route them correctly.

Report Delivery

Report Delivery

How to get reports into Google Drive

Use one of the following:

📥 Manual Upload – Download emailed reports and move them to your Drive folder

🤖 Automation – Use n8n to watch Gmail for user@example.com, extract attachments, and upload to Drive

💻 Drive Sync Folder – Use a local folder synced to Google Drive with rules for report types

Reports must match expected filenames so the flow can identify and classify them.

Upgrade! 🚀

Upgrade! 🚀

Apply for an Amazon Advertising API developer account to unlock full automation:

Generate reports programmatically via the Reports API

Fetch report files directly into n8n using HTTP or custom nodes

Eliminate email + Drive dependency entirely

🔗 https://advertising.amazon.com/API/docs/en-us/

Once approved, you can schedule report generation and download all required data securely and automatically. Double click to edit me. Guide

Trigger

Trigger

You may replace this with a scheduled event or poll the folder for changes.

Change!

Change!

Edit these email options.

Amazon Ads AI Optimization

Amazon Ads AI Optimization

Purpose and structure

This folder contains the Amazon Ads AI Optimization workflow. Its executable nodes use chainLlm, code, extractFromFile, gmail, googleDrive, if, lmChatOpenAi, manualTrigger, merge, set. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

When clicking ‘Test workflow’

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/1301_Code_Extractfromfile_Automation_Triggered.json MIT; preserve source notices.

More in AI & research