As an SEO, writing lots of title tags and meta descriptions can get very tedious very quickly.
So why not automate this work?
ChatGPT has taken the internet by storm and shown itself to be great at tackling these sorts of tasks, see an example result from asking ChatGPT to create a meta description below:
Of course the outputs from ChatGPT are not perfect, but they can form a great basis to work off of and with some light editing are at least in my personal experience so far quite usable or acceptable.
Sadly, as of this writing circa January of 2023, the only way to interact with ChatGPT is via OpenAI’s app in a web browser 1 on 1.
For bulk operations or other commercial use cases, this doesn’t scale well.
Enter the GPT-3 text-davinci-003 model and associated API.
It’s capable of producing similar or identical results as ChatGPT, but most importantly, it has an API available.
What is a good way of interacting with this API that is approachable, easy to get started with, and straightforward you might be asking?
Google Sheets and an Apps Script to talk to OpenAI’s API can get the job done.
With a Google Sheet and a simple Apps Script, we can use OpenAI’s text-davinci-003 to generate both meta descriptions and title tags (and a whole lot more) in batches and potentially even directly import the results into a CMS system or other application.
With all of this in mind, I’ve created a spreadsheet template that can help you do the following:
- Write a meta description from a URL or a text block
- Write title tags from a URL or a text block
Link to the spreadsheet template is below, and a guide on how to use it can be found below here and also on the first “Readme” tab of the spreadsheet.
Getting your OpenAI API Key
New OpenAI Users
- Visit the OpenAI website at openai.com
- Click ‘Get Started’ in the top right corner
- Create a new OpenAI account by entering your email address and creating a password
- Verify your email address
- Log into your OpenAI account
- Click the ‘API Keys’ tab
- Click ‘Create New Key’
- Enter a name for your key and click ‘Create Key’
- Your API key will be displayed. Copy it and store it securely.
Existing OpenAI Users
- Visit the OpenAI website and log into your account.
- Click on your profile name in the top right corner of the page.
- On the left side menu, select the ‘API Keys’ tab.
- Here you will see a list of all your API keys associated with your account.
- You can click the ‘Create a new key’ button
- A new API key will be generated for you and will be displayed on the screen.
- Copy and save this key as it will only be displayed once.
Adding your API Key to Sheets
- At the top, click on “Extension” > “App Script”
- At the very first row of the code, insert your API Key in between the double quotes. (Note: Please make sure that there are no extra spaces.)
- Save the code by clicking the Save project icon or pressing CTRL + S.
- Once saved, you’re now ready to use the generator.
- Prompt – A non-input field of pre-defined string of text used to provide a context for the generation of an AI’s response.
- URL or Text – An input field for entering a URL or plain text.
- Focus Keyword (Optional) – An optional input field for entering a keyword or phrase to focus on when creating the meta description.
- Meta Description/Title Tag Result – A non-input field to display the generated meta description/title tag based on the entered URL or text.
How to use the Generator Sheet
- Go to Meta Description Generator or Title Tag Generator
- Enter your desired URL or text in the URL or Text field (Column B). Integrated formulas will be able to detect automatically if the input is a URL or a text.
- To create a result that is more targeted, you can enter keyword(s) in the Focus Keyword field (Column C)
- Once done, Prompt and Result will automatically be generated based on the user input.
- Note: Prompt and Result fields are formulated, manually entering text in this fields may cause to broken formulas.
- You can always undo your action by pressing CTRL + Z.
First, a big high five and thank you is due here to Elliott Davidson from Contrast Digital and the example he recently shared of using Google Sheets to automate eCommerce product descriptions with OpenAI GPT-3 text-davinci-003 which formed the basis of my work above.
Using Google Sheets Apps Scripts in this way is incredibly straightforward, it does a great job of removing external dependencies and costs that building something similar using OpenAI’s Zapier connector and Google Sheets would create.
Hopefully this is just the beginning of many potentially useful applications of GPT-3 that are scalable and solve real world problems or pain points.
What do you want to build?