AI Blog Post Generator
Checking Google Sheets connection...
Google Apps Script Setup Instructions
Step 1: Create Google Apps Script
- Go to script.google.com
- Click "New Project"
- Replace the default code with the script below
- Save the project with a name like "Blog Generator API"
function doPost(e) { try { const data = JSON.parse(e.postData.contents); const sheet = SpreadsheetApp.openById('YOUR_SHEET_ID_HERE'); const blogSheet = sheet.getSheetByName('Blog Posts') || sheet.insertSheet('Blog Posts'); // Create headers if they don't exist if (blogSheet.getLastRow() === 0) { blogSheet.getRange(1, 1, 1, 10).setValues([[ 'ID', 'Title', 'Subject', 'Primary Keyword', 'Target Audience', 'Status', 'Date Created', 'Author', 'Keywords', 'Excerpt' ]]); } // Add the new blog post data blogSheet.appendRow([ data.id, data.title, data.subject, data.primaryKeyword, data.targetAudience, data.status, data.dateCreated, data.author, data.keywords.join(', '), data.excerpt ]); return ContentService.createTextOutput(JSON.stringify({ success: true, message: 'Blog post added successfully' })).setMimeType(ContentService.MimeType.JSON); } catch (error) { return ContentService.createTextOutput(JSON.stringify({ success: false, error: error.toString() })).setMimeType(ContentService.MimeType.JSON); } } function doGet() { return ContentService.createTextOutput('Blog Generator API is running'); }
Step 2: Configure and Deploy
- Replace 'YOUR_SHEET_ID_HERE' with your actual Google Sheets ID
- Click "Deploy" → "New Deployment"
- Choose "Web app" as the type
- Set "Execute as" to "Me"
- Set "Who has access" to "Anyone"
- Click "Deploy" and copy the Web App URL
- Paste the URL in the settings above