Get the Power of ChatGPT in Your Spreadsheets and Docs
Allie K. Miller
#1 Most Followed Voice in AI Business (1.5M) | Former Amazon, IBM | Fortune 500 AI and Startup Advisor, Public Speaker | @alliekmiller on Instagram, X, TikTok | AI-First Course with 30K+ students - Link in Bio
If you're only using ChatGPT, you're missing out.
Imagine a world where now you can harness the power of artificial intelligence to make your Google Spreadsheets work smarter, not harder, for you. Well, it's a game-changer, and I've got the perfect step-by-step guide on how to access the OpenAI API into Google Spreadsheets—even if you're not super tech-savvy.
One popular use case for this powerful integration is automating content generation for marketing campaigns. Envision a spreadsheet that generates compelling headlines, engaging social media captions, and persuasive email content—all driven by AI. Or picture an AI financial analyst, leveraging the OpenAI API to automatically generate insights and suggestions based on datasets, helping you make data-driven decisions faster and more efficiently than ever before.
That's just the tip of the iceberg when it comes to the incredible things you can do with this combo.
I shared this guide as a Twitter thread, and it quickly became one of my most bookmarked threads ever, so I hope you also find it genuinely useful.
If you're curious about unlocking the potential of OpenAI APIs in your spreadsheets, read on and let's dive into this together.
Why use the API over ChatGPT?
ChatGPT and similar AI chat systems are great for one-off requests, conversations, visualizations, editing, and maintaining multiple chat threads. But that's the same thing that holds it back—you can only send the system one message at a time.
What if you could send it 500 messages at once? That's where an API comes in. An API, or an Application Programming Interface, can process requests and share data at a much larger scale than using an app. The user is a machine and not a human, so it's not limited by the constraints of a user interface designed for human interaction. This scalability makes APIs a powerful tool for developers and businesses to grow and expand their services.
We're going to use an API inside of a spreadsheet using an extension.
By doing this:
The future of spreadsheets is here, and it's waiting for you.
Let's get into it.
How to Integrate OpenAI API into Google Sheets
Step 1: Check out extensions
Open a new Google Sheet in your browser here.
Click on Extensions > Add-ons > Get Add-ons
Step 2: Find and add "GPT for Sheets and Docs"
Search for GPT for Sheets and Docs and click on the icon that matches the screenshot below.
Always read terms and conditions for new products (especially data and AI). Make sure you understand them before agreeing to them.
Click Install > Continue
Select the right Google account > Next > Done
Amazing! The Google part is done. Now onto the OpenAI part.
Stay with me, anyone can do this...
Step 3: create an OpenAI account
Go to the OpenAI website and sign up for an account if you don't have one (if you're using ChatGPT, you already have one—it might be through a Google or Microsoft log-in).
Step 4: get an OpenAI API
ChatGPT is separate from the OpenAI API. Even if you use ChatGPT, and even if you signed up for ChatGPT Plus, you will need to create a new API key that will be billed separately and on top of any ChatGPT charges you incur.
As mentioned with the extension, always be sure to read the data and security policies when using data and AI systems. OpenAI's updated policy as of March 1, 2023 can be found here.
In order to create a new API that only you can access, log into your OpenAI account and head to the API page here: https://platform.openai.com/account/api-keys
Click "create new secret key" which is either in the middle of the page or on the left within "API keys" menu
Step 5: copy the API key
When prompted, feel free to give your API key a name for easy reference. OpenAI will generate a long API key with jumbles of letters and numbers and symbols. DO NOT share this API key anywhere, keep it safe.
Copy this key with the green copy button on the right.
Step 6: bring the secret code back to Google
Now we're gonna give Google Sheets that code so it knows the exact OpenAI account to use (and bill, if you finish the free credits).
Click on Extensions > GPT for Sheets and Docs > set API key
Paste the copied jumble > check > if works, save API key
Congratulations!
Google Sheets and OpenAI can now talk to each other. You are fully set-up.
Automating Social Media Planning: a Use Case Walk-Through
Now we get to the fun part. I'm going to create 10 full social media launch plans for 10 different projects in under a minute.
For one-off tasks, I still use ChatGPT/Poe/Bing/Bard/Claude, but for many tasks at once, the API is infinitely more efficient.
Step A: grab a blank spreadsheet
Open a new Google spreadsheet, title it whatever you want
Step B: pick your task
Decide on a repeated task you want GPT to take on.
Here, I'm going to feed OpenAI a ton of social media projects, and it's going to create a launch plan for every single one of them in just a few seconds.
领英推荐
Wild, I know.
Step C: create a master prompt
Write up one prompt you want to apply to all of these tasks. See green box on the right of the screenshot below.
(When you get more advanced, you can have a variety of prompts, dynamic prompts, you can edit it, doesn't really matter. But just start with one single prompt. For the eager among you, there is an advanced example and full explanation and formula walk-through at the end.)
The example below is for social media, but you can easily create prompts for Sales, Analytics, Operations, etc.
I tend to start my prompts with an identity labeler and sometimes will include values. Ex: "You are a senior QA engineer who loves efficiency"
Step D: type out all your inputs
Here, I include 10 social media tasks that I want to launch.
Put this all in column A, one task per row.
Step E: use the GPT formula
In cell B2, type "=GPT" to call the GPT formula.
It will ask you for a prompt (the master prompt we wrote in the green box) and some other parameters, like the value (the input you want to give it, in this case, the social media task).
Step F: apply the right cells
My master prompt is in D3, my value is in A2.
I lock with cell D3 (adding $ before both the D and 3) so that I can drag this formula anywhere and the referenced prompt cell stays consistent. I did not change any other parameter in the formula (like temperature).
Step G: hit enter
Heck yeah, we got our first reply. GPT gave us a step-by-step launch for my new newsletter and now I can give that to my new social media manager as a starting point. But let's get the step-by-step launch for all 10 of these projects...
Step H: apply the formula to all inputs
Drag the bottom right corner of cell B2 down. This will apply the GPT formula to all of these inputs (while keeping the prompt locked). It'll say "Loading..." while it calls the API and returns the output. Waiting times vary, but this took less than 20 seconds.
Step I: you got all the answers, now evaluate the output
Boom — 10 social media launch plans done in just a few minutes!
But now, evaluate. Was this what you wanted? Does this align to your goals? Do you want to change the prompt? Or show it to a coworker for feedback? Test something new in a second tab?
For Advanced Users: Multi-Variable Prompting
There is a way to embed multiple variables into your prompt, which can make for some epic automations. It's a bit advanced, but I'll break it down.
If you want your prompt to be dynamic with multiple variables (like details about a customer or teammate, or statistics on your product's recent performance), I tend to use the built-in "substitute" formula in a nested method with variable placeholders like AAA (for the data in column A), BBB (for the data in column B), and so on. You can see the formula I used in the function section at the top of the screenshot, but if you want to copy and paste, here it is: '=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(D2, "AAA", A2), "BBB", B2), "CCC", C2)'
Meaning, you're telling Google Sheets, "OK, start with what I've got in D2. But if ever you see AAA in that content, go ahead and replace those three characters with the value I have in A2. And if ever you see BBB, replace that with whatever I've got in B2. And same for CCC and C2."
For this advanced example, as you'll see below, I use two columns for the prompt—one with the variable placeholders and one with the full final prompt. I prefer this way so I can read the whole prompt and it's not buried in a function call. Also note that I am no longer using the lock method with the $ symbol for the multi-variable approach. I write the prompt once and drag it down for as many rows as I have. Then I call the API in the final column (F) without passing a value to it (so the formula in F2 is just '=GPT(E2)' for the email generated below).
With one click and drag, I can generate custom emails for hundreds or thousands of team members or customers.
Frequently Asked Questions (FAQ)
Is it free? Yes, until you hit the credit limit. Then it's paid. GPT-3.5-turbo is $0.002 / 1K tokens, which is equivalent to about 1,300 words — remember that includes the words you send in (your prompt) and the words that GPT spits back out (the output). More pricing info here. If you are worried about accidentally spending too much, set a soft billing limit (a price you'll receive a warning notification at) and hard price limit (a price that OpenAI will turn off your API at) on the OpenAI API usage limits page here. Messing around with a few rows a few times will cost cents and hundreds of rows a few times will be several dollars.
How do I make the results better? First, try improving your prompt. You may also benefit from the latest GPT version. GPT-4 is the latest model from OpenAI, but has a waitlist. Sign up here.
Can I also use this for Google Docs? Yep, it's the same extension and process and just as easy. Just start from a blank Google Doc instead of Sheet.
What if I have other issues with the extension? Check out their documentation and solutions here.
Why should I use the API? Cost-effective scale and a bunch of other reasons previously mentioned in this article.
Is this an ad? I do brand partnerships for products I love, but no, this is not a brand partnership or ad, and I do not receive a commission. I genuinely want everyone to know this stuff, and the replies and DMs from Twitter have really warmed my heart.
Who should use this? This thread is for non-technical users looking to get more out of the newest AI models. It's a couple clicks, and you're done.
How do I get more AI content? Easy. Follow me on LinkedIn, Twitter, Instagram, TikTok, and YouTube for more about AI, tech, and business. I have about 1.5 million followers and am an AI advisor to Fortune 500 companies and top startups, as well as an AI investor and founder. I previously worked in machine learning at IBM Watson and Amazon (AWS), and I love upleveling millions and preparing us all for the AI future.
Need more motivation from newbies just like you? Here are some of the replies I got on Twitter. It's easy and you can do it, I promise.
So there you have it. You are now equipped with the (powerful) knowledge and (simple) steps to start leveraging the power of ChatGPT in your Google Sheets and Docs. As you check out this extension and integration, remember to get creative and funky with it. Whether you're looking to streamline your workflow, generate content, or unearth data-driven insights, AI-enhanced spreadsheets are going to revolutionize the way you work.
Don't forget to share your experiences and use cases with others so we can level up together.
And if you found this cool or useful or think your friends might like it, I would be honored if you shared it.
Happy experimenting ??
AI-Trainer to Researchers, Educators and Grant Writers ? Specialized in Claude & (Chat)GPT ? +45M€ EU grants collected? Building AI tools?1000+ experts trained? Partner in 2 ongoing Erasmus Plus projects
4 个月Multi-variable prompting is simply insane. Super clever. I followed your steps, and created smart G-sheet :) for creatiing go-to-market strategies for different ideas and target groups. My head is spinning, cause I feel (not know fully yet) the amazing potential of this approach!
Owner of Chipsets.com, 5GChipsets.com, GenAIInsure.com, Human-LevelAI.com, GPGPUs.com, 5GChip.com, HardwareAccelerators.com, CarsAutonomous.com, VehicleAutonomous.com, GreatBritain.ai -message me to acquire these domains
7 个月Domain on Sale: AI-Chipset.com Ready to dominate the AI industry? Own the Future of AI with the premium domain AI-Chipset.com Ideal for AI start-ups, tech innovators, and industry leaders. Interested? DM me to acquire, or go ahead and simply Buy it Now using the following link (link expires on 19 February 2024). https://lnkd.in/e5qeU9Qs
Experienced in System Infrastructure & Architecture. Managed K8s services dev with Golang, Temporal. Delivered PoCs & MVPs. Flux: scaling tens of K8s clusters and 100’s of apps. AI innovator with GPT (aitrailblazer.com).
8 个月I'd expensive trying different prompts to achieve desired results. Even then the results are generic and you'll end with similar results as everyone using the same tool. There is a need of custom targeted prompts which work in background to give you better results. Then the expense would be justified.
Google Workspace Deployment Specialist
1 年If you are a Google workspace user, you only have to active duet AI and you are gonna have for gmail, docs and meet
Co-Founder of Altrosyn and DIrector at CDTECH | Inventor | Manufacturer
1 年ChatGPT is certainly useful, but OpenAI APIs offer even more powerful possibilities. Have you considered leveraging the Generative Pre-Trained Transformer (GPT-3) model to create AI-powered spreadsheets? Plus, with the API you can easily incorporate natural language processing, sentiment analysis, and other AI-powered features into your workflows. Fascinating stuff! What do you think has been the biggest challenge in transitioning to these new AI-powered spreadsheet workflows?