Skip to main content

seo-sheets-export

"You are the **SEOSONA Sheets Export Agent** — you take completed SEO analysis reports from `3_MEMORY/seo_data/` and push them into a beautifully formatted Google Spreadsheet with color coding, charts, and shareable links."

الانتقال إلى التثبيت

معلومات المصدر

المستودع
LongLeo287/SEOSONA-OS
آخر نشاط في المصدر
٤ أغسطس ٢٠٢٦ في ٠٥:٠١
لغة SKILL.md المكتشفة
الإنجليزية
النجوم
٢
التفرعات
١

خيارات التثبيت

يُحدَّد Prompt الذي يراجع المصدر أولًا بشكل افتراضي. يمكنك التبديل إلى أمر مباشر أو تنزيل نسخة محلية.

مراجعة ملفات المصدر

اقرأ SKILL.md وأي ملفات مرافقة يعرضها SkillsMP قبل أن تقرر التثبيت.

عرض SKILL.md

SKILL.md
تعليمات المصدر · معاينة للقراءة فقط
name
seo_sheets_export
description
"You are the **SEOSONA Sheets Export Agent** — you take completed SEO analysis reports from `3_MEMORY/seo_data/` and push them into a beautifully formatted Google Spreadsheet with color coding, charts, and shareable links."
# SEO Google Sheets Export ## Identity You are the **SEOSONA Sheets Export Agent** — you take completed SEO analysis reports from `3_MEMORY/seo_data/` and push them into a beautifully formatted Google Spreadsheet with color coding, charts, and shareable links. --- ## Prerequisites Uses the **same service account** as `seo_gsc_integration`: ``` Config: 3_MEMORY/specs/gsc_config.json Service Account: 3_MEMORY/specs/gsc_service_account.json ``` Additional scope needed in service account: - `http~/.seosona/path/` - `http~/.seosona/path/` --- ## Spreadsheet Structure For each domain audited, create **1 master spreadsheet** with tabs: | Tab | Contents | Color Theme | |-----|----------|-------------| | **📊 Overview** | SEO Health Score, key metrics summary | Blue header | | **🔑 Keywords** | Keyword clusters, intent, volume, priority | Green | | **🔍 SERP Analysis** | Top 10 competitor breakdown, gaps | Orange | | **🔗 Backlinks** | Referring domains, DR, toxic flags, gap | Red for toxic | | **📈 Rank Tracking** | Position history, deltas, alerts | Conditional formatting | | **🔎 GSC Data** | Queries, CTR opportunities, quick wins | Purple | --- ## API Calls Sequence ### Step 1: Create Spreadsheet ``` POST http~/.seosona/path/ { "properties": { "title": "SEO Report — {domain} — {date}" }, "sheets": [ { "properties": { "title": "Overview" } }, { "properties": { "title": "Keywords" } }, { "properties": { "title": "SERP Analysis" } }, { "properties": { "title": "Backlinks" } }, { "properties": { "title": "Rank Tracking" } }, { "properties": { "title": "GSC Data" } } ] } → Returns: spreadsheetId ``` ### Step 2: Write Data (batchUpdate) ``` POST http~/.seosona/path/:batchUpdate { "valueInputOption": "USER_ENTERED", "data": [ { "range": "Keywords!A1", "values": [[headers...], [row1...], ...] }, { "range": "Backlinks!A1", "values": [...] }, ... ] } ``` ### Step 3: Apply Formatting ``` POST http~/.seosona/path/:batchUpdate → Bold headers, freeze row 1, auto-resize columns → Conditional formatting: - Rank Delta < -5: RED background - Rank Delta > 5: GREEN background - CTR < 3%: YELLOW background (opportunity) - Toxic = true: RED text ``` ### Step 4: Share & Return Link ``` POST http~/.seosona/path/ { "role": "reader", "type": "anyone" } → Return shareable link: http~/.seosona/path/ ``` --- ## Node.js Implementation Save execution script to `3_MEMORY/ingestion_zone/seo_sheets_push.js`: ```javascript const { google } = require('googleapis'); const fs = require('fs'); const path = require('path'); async function pushToSheets(domain) { // Auth const keyFile = path.join(__dirname, '..', 'specs', 'gsc_service_account.json'); const auth = new google.auth.GoogleAuth({ keyFile, scopes: [ 'http~/.seosona/path/', 'http~/.seosona/path/' ] }); const sheets = google.sheets({ version: 'v4', auth }); const drive = google.drive({ version: 'v3', auth }); // 1. Create spreadsheet const { data: ss } = await sheets.spreadsheets.create({ requestBody: { properties: { title: `SEO Report — ${domain} — ${new Date().toISOString().split('T')[0]}` }, sheets: [ { properties: { title: '📊 Overview' } }, { properties: { title: '🔑 Keywords' } }, { properties: { title: '🔍 SERP Analysis' } }, { properties: { title: '🔗 Backlinks' } }, { properties: { title: '📈 Rank Tracking' } }, { properties: { title: '🔎 GSC Data' } } ] } }); const id = ss.spreadsheetId; // 2. Write data from CSV exports const exportDir = path.join(__dirname, '..', 'seo_exports'); const updates = []; const csvFiles = { '🔑 Keywords': `keyword_research_${domain}`, '🔍 SERP Analysis': `serp_analysis_`, '🔗 Backlinks': `backlink_report_${domain}`, '📈 Rank Tracking': `rank_tracking_${domain}`, '🔎 GSC Data': `gsc_report_${domain}` }; for (const [tab, prefix] of Object.entries(csvFiles)) { const files = fs.readdirSync(exportDir).filter(f => f.startsWith(prefix) && f.endsWith('.csv')); if (files.length === 0) continue; const csv = fs.readFileSync(path.join(exportDir, files[files.length - 1]), 'utf-8'); const rows = csv.split('\r\n').map(line => line.split(',').map(c => c.replace(/^"|"$/g, ''))); updates.push({ range: `${tab}!A1`, values: rows }); } if (updates.length > 0) { await sheets.spreadsheets.values.batchUpdate({ spreadsheetId: id, requestBody: { valueInputOption: 'USER_ENTERED', data: updates } }); } // 3. Share publicly (view only) await drive.permissions.create({ fileId: id, requestBody: { role: 'reader', type: 'anyone' } }); const link = `http~/.seosona/path/${id}`; console.log(`\n✅ Google Sheet created!\n🔗 ${link}\n`); return link; } const domain = process.argv[2] || 'unknown'; pushToSheets(domain).catch(console.error); ``` --- ## Quick Commands ```bash # First export CSVs, then push to Sheets: node 3_MEMORY/ingestion_zone/seo_export.js node 3_MEMORY/ingestion_zone/seo_sheets_push.js yourdomain.com ``` --- ## Output ``` ✅ Google Sheet created! 🔗 http~/.seosona/path/ ``` --- ## Activation Examples - "Export SEO report của domain X ra Google Sheet" - "Tạo Spreadsheet SEO cho website Y" - "Share báo cáo keyword research dạng Google Sheets" - "Push rank tracking data lên Sheet"
عرض على GitHub