Automating Social Media Scheduling with Google Apps Script and ChatGPT
Managing social media efficiently can be a real challenge, especially when dealing with bulk scheduling. Recently, I faced a problem: how to ensure AI-generated images match their corresponding post titles while also optimizing them for platforms like Pinterest.
The Problem: Image Sizes
When using Zimmwriter’s bulk social media scheduler, the tool automatically pulls blog images—but often at resolutions that aren’t ideal for Pinterest or other visual-heavy platforms. Since I wanted full control over the images used for my surreal AI art on ReachingMyDreams, I generated new images in optimal dimensions for Pinterest and Facebook/Instagram stories.
If you’re not working with AI-generated images, you can still make this work by renaming your social media files or exporting them via Lightroom before running the script. But for those of us automating large batches, a script was the perfect solution.
The Solution: A Google Apps Script for Image Handling
To solve this, I built a Google Apps Script that:
✅ Pulls image filenames from a public directory.
✅ Matches the images to post titles based on naming conventions (e.g., post_title_001.jpg).
✅ Handles multiple images for the same post title using a structured naming system.
✅ Populates a Google Sheet with comma-separated image URLs, making them ready for bulk upload into schedulers like Sociamonials.
This approach saves hours of manual work and is a game-changer for automating Pinterest and other social media platforms.
How It Works
1️⃣ Generate AI Images: Create images optimized for Pinterest (or any platform) using your post titles.
2️⃣ Upload to a Public Directory: I used an optional index.php script to create an easy-to-scrape public listing of my image files.
3️⃣ Run the Google Apps Script: The script scrapes the directory, matches filenames to post titles, and populates a Google Sheet with the image URLs.
4️⃣ Bulk Upload to Sociamonials: I pasted the image URL column into Sociamonials’ bulk import template, and it worked flawlessly! The only downside is that I can only upload 1,000 posts at a time—this process generated 3,000 posts, each with 2-4 pictures.
5️⃣ Scheduling Strategy: I set it to post on Pinterest three times a day.
Real-World Testing & Results
I tested this solution with 1,000 post titles and 3,000 images. The results? It worked flawlessly! 🚀
I did this last weekend, and so far, my Pinterest stats from the past 7 days have seen significant improvements:

Overall Performance (Compared to the previous 7 days)
📈 Impressions: 2.78k (+44%) 📈 Engagements: 133 (+23%) 📈 Outbound Clicks: 2 📈 Saves: 7 (+45%) 📈 Total Audience: 1.79k (+31%) 📈 Engaged Audience: 87 (+38%)
While I haven’t yet formatted and uploaded everything to my scheduler (because of the 1000 post limit), the automation already saves me tons of time by eliminating tedious manual work.
Open-Source Code & How to Use It
I’ve made the script publicly available on GitHub! If you want to check it out or improve on it, you can find it here: ➡️ GitHub Repository: Image-Puller-for-Social
Setup Instructions:
1️⃣ Prepare Your Directory: Place your images in a publicly accessible directory.
2️⃣ Install the Script: Copy the fillImageUrls.gs script into Google Apps Script in your Google Sheet.
3️⃣ Update Your Configurations:
- Modify the script to match your spreadsheet ID and sheet name.
- Adjust the directory URL to your hosted images.
- Ensure filenames follow the correct naming conventions.
- 4️⃣ Run the Script: Execute the script and check the logs if you need debugging output.
Final Thoughts
If you’re struggling with bulk social media scheduling and image management, this script can save you hours of work. It’s especially useful for those leveraging Zimmwriter’s automation but looking for better image resolution and platform optimization.
If you give it a try, let me know how it works for you—or if you run into any issues! I’d love to hear your feedback and continue improving the script. 😊
0 Comments