π¬ Sync OpenAI vector stores from Google Sheets with Drive and AWS S3
β‘ 20 views Β· π¬ Document Extraction & Analysis
Description
Quick overview
This workflow runs every two minutes to sync a Google Sheets file queue with an OpenAI Vector Store by deleting outdated entries, downloading new files from Google Drive, AWS S3, or a URL, uploading them to OpenAI, and updating each rowβs processing status.
How it works
- Runs every two minutes and reads all rows from a Google Sheets queue.
- For rows marked as
outdated, deletes the referenced file from the OpenAI Vector Store and updates the row status todeletedin Google Sheets. - Filters for rows that have a
file_urland no status, then processes them one by one. - Downloads each file based on its URL pattern using Google Drive, AWS S3, or an HTTP download.
- Uploads the downloaded file to OpenAI Files (purpose: assistants) and adds the returned file ID to the target OpenAI Vector Store.
- Waits and polls the OpenAI Vector Store file status until it is
completed, then marks the row asactivein Google Sheets. - If the file status returns anything other than
completedorin_progress, marks the row aserrorin Google Sheets and continues with the next item.
Setup
- Add credentials for Google Sheets OAuth2, OpenAI API, Google Drive OAuth2, and AWS (IAM) for S3 access.
- Replace
YOUR_GOOGLE_SHEET_IDin all Google Sheets steps and ensure the sheet includesfile_url,status,openai_file_id,last_updated, and arow_numbercolumn used for updates. - Replace
YOUR_VECTOR_STORE_IDin the OpenAI Vector Store delete, add, and poll HTTP requests. - Replace
YOUR_S3_BUCKET_NAMEin the AWS S3 download step. - Replace
YOUR_ARTICLES_DOMAINin the URL routing rules used to decide when to download via HTTP.
Additional info
Contact
LinkedIn: linkedin.com/in/salman-mehboob-pro Email: salmanmehboob1947@gmail.com
π Nodes Used
Google Sheets, HTTP Request, Google Drive, AWS S3, Schedule Trigger, Filter
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File