How to Use ChatGPT Inside Google Sheets (3 Working Methods, Free and Paid)
How to use ChatGPT in Google Sheets: OpenAI's own add-on, Google's built-in AI function, or a free Apps Script formula. Steps, costs and limits.
Quick answer: The fastest way is OpenAI's own ChatGPT for Google Sheets add-on, installed from the Google Workspace Marketplace. Free? The add-on is listed as "Free of charge with paid features", and you need a ChatGPT account. Time: about 5 minutes. If you want a =GPT() style formula in a cell, Method 3 builds one for free with Apps Script, plus a small pay-per-use API cost.
What do you need before you start?
You need a Google account that can open Google Sheets, and a spreadsheet to work in. Beyond that, each method has its own requirement.
- Method 1 (OpenAI add-on): a ChatGPT account. The Marketplace listing says it requires an active ChatGPT Free, Go, Pro and Plus plan, and is also available for Business, Enterprise, Edu and K-12 users. The listing's wording on plans is not fully consistent, so confirm on the listing page.
- Method 2 (Google's
=AI()function): an eligible Google Workspace or Google AI plan, according to Google's help page. - Method 3 (Apps Script formula): an OpenAI API key. You create it in your OpenAI developer account. Treat it like a password.
How do you use ChatGPT inside Google Sheets? (Method 1: the OpenAI add-on)
Install ChatGPT for Google Sheets from the Marketplace, then open it from the Extensions menu. It appears as a sidebar where you chat in plain language and ChatGPT builds, edits or explains your sheet.
- Open the ChatGPT for Google Sheets listing. The publisher shown is OpenAI.
- Click Install and approve the permissions Google shows.
- Open a new or existing Google Sheet.
- Click Extensions in the menu bar.
- Scroll to ChatGPT and click Open.
- In the sidebar on the right, log in with your ChatGPT account.
- Type a request, for example: "Add a column that labels each row in column B as positive or negative."
- Read the changes ChatGPT made before you keep working.
The listing says ChatGPT can take actions inside your spreadsheet, so review changes closely to avoid unintended edits. Use Edit > Undo or File > Version history if something goes wrong.
Things to know, all from the listing (these are OpenAI's own statements):
- Spreadsheet chats are separate from your normal ChatGPT history.
- Memory is not available.
- Chats, attachments and workbook content may be shared with Google and OpenAI so the add-on can read and update your sheet.
- The add-on says it respects your ChatGPT data training preferences, and you can delete or download your data from its Settings.
Can Google Sheets do this itself? (Method 2: the built-in =AI() function)
Yes, if your plan allows it. Google's own =AI() function (also written =Gemini()) runs a prompt in a cell, but it uses Google's Gemini, not ChatGPT. It is a close substitute if you only want AI formulas.
- In a cell, type a formula such as
=AI("Generate slogan for event in 10 words or less", A2). The syntax isAI("prompt", [optional range]). You can also use Insert > Function > AI. - Select the cell or cells that contain the AI function.
- Click Generate and Insert.
- To redo a result, click Refresh and Insert.
Google's help page lists these limits:
- Only the first 350 selected cells with AI functions are generated at a time.
- There are short-term and long-term generation limits. If you hit the long-term one, Google says to wait 24 hours and try again.
- Responses are text only, and the function cannot see your whole spreadsheet or Drive files. Pass the data in through the range argument.
- You cannot undo or redo the function. Regenerate instead.
- Embedded AI functions, such as one wrapped inside
IF(), are not supported.
If you see "AI function not available", the page says the cause may be that you are not in Workspace Experiments, your plan lacks access, or an admin or language setting blocks it.
How do you add a ChatGPT formula yourself? (Method 3: Apps Script and the OpenAI API)
This builds a =GPT("your prompt", A2) formula using a short script. You pay OpenAI per token. It is the most flexible option, and the only one that gives you a formula backed by an OpenAI model.
Step A: save your API key safely.
- Open your Google Sheet.
- Click Extensions > Apps Script.
- At the left, click Project Settings.
- Under Script Properties, click Add script property.
- For Property, type
OPENAI_API_KEY. - For Value, paste your key.
- Click Save script properties.
These steps follow Google's Properties Service guide.
Step B: paste the script.
- At the left, click Editor.
- Delete the sample code and paste the script below.
- Click Save project.
/**
* Ask an OpenAI model a question from a cell.
* Usage: =GPT("Summarize this in 10 words", A2)
* @param {string} prompt The instruction.
* @param {string|Array} input Optional cell or range with the text to work on.
* @return {string} The model's answer.
* @customfunction
*/
function GPT(prompt, input) {
if (!prompt) return "";
var key = PropertiesService.getScriptProperties().getProperty("OPENAI_API_KEY");
if (!key) return "Error: add OPENAI_API_KEY under Project Settings > Script Properties";
var data = "";
if (Array.isArray(input)) {
data = input.map(function (row) { return row.join(" "); }).join("\n");
} else if (input !== undefined && input !== null) {
data = String(input);
}
var text = String(prompt) + (data ? "\n\n" + data : "");
// Cache identical requests so recalculation does not bill you twice.
var cache = CacheService.getScriptCache();
var digest = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, text);
var cacheKey = digest.map(function (b) {
return ((b + 256) % 256).toString(16).padStart(2, "0");
}).join("");
var cached = cache.get(cacheKey);
if (cached) return cached;
var response = UrlFetchApp.fetch("https://api.openai.com/v1/responses", {
method: "post",
contentType: "application/json",
headers: { Authorization: "Bearer " + key },
payload: JSON.stringify({ model: "gpt-5-mini", input: text }),
muteHttpExceptions: true
});
var body = JSON.parse(response.getContentText());
if (response.getResponseCode() !== 200) {
return "Error: " + (body.error && body.error.message ? body.error.message : response.getResponseCode());
}
var answer = "";
(body.output || []).forEach(function (item) {
if (item.type === "message") {
item.content.forEach(function (part) {
if (part.type === "output_text") answer += part.text;
});
}
});
if (answer) cache.put(cacheKey, answer, 21600);
return answer;
}
Step C: use it.
- Go back to your sheet.
- In an empty cell, type
=GPT("Fix the grammar", A2)and press Enter. - The first time, Sheets may show Loading... for a few seconds.
The endpoint, headers and model plus input body come from OpenAI's quickstart. The answer is read from the output list, in the item of type message, which holds output_text parts.
Verify this step: the exact label of the save button may differ slightly between versions of the Apps Script editor.
Which method should you choose?
Pick the add-on for editing and cleaning sheets by chat, =AI() for quick in-cell prompts if your plan has it, and Apps Script when you want a real formula using an OpenAI model.
| Method | Cost | Difficulty | Limits | Best for |
|---|---|---|---|---|
| 1. OpenAI add-on | Listed as free of charge with paid features; needs a ChatGPT account | Easy | Plan eligibility; chats separate from ChatGPT history; no memory | Building and fixing whole sheets by chat |
2. =AI() | Needs an eligible Workspace or Google AI plan | Easy | Plan eligibility; 350 cells per run; text only | Labeling or summarizing rows with Gemini |
3. Apps Script =GPT() | Pay per token to OpenAI | Medium | 30-second limit per call | Custom formulas you control |
What's free and what costs money?
As of 13 October 2026, the add-on is listed as "Free of charge with paid features", and =AI() needs an eligible paid plan. Only the Apps Script method has a published per-use price.
OpenAI's pricing page lists these standard prices per 1 million tokens (as of 13 October 2026):
| Model | Input | Output |
|---|---|---|
| gpt-5-nano | $0.05 | $0.40 |
| gpt-4o-mini | $0.15 | $0.60 |
| gpt-5-mini | $0.25 | $2.00 |
The script above uses gpt-5-mini. To cut cost, change gpt-5-mini to gpt-5-nano in the code. Cost scales with the number of rows, because each formula cell is its own request. Test on 5 rows before filling down 5,000.
What can go wrong, and how do you fix it?
Most failures are a missing key, a timeout or a plan limit. Here are the common ones.
#ERROR!with "Exceeded maximum execution time". Google says a custom function must return within 30 seconds. Shorten the prompt or use a smaller model.- "Error: add OPENAI_API_KEY..." The key is missing or named differently. Recheck Project Settings > Script Properties.
- Cell shows
Loading...forever. Google notes that volatile functions such asNOW()orRAND()cannot be used as arguments to a custom function. - "AI function not available". Your plan, Experiments enrollment, admin settings or language setting may block
=AI(). - Nothing appears under Extensions. Reinstall the add-on from the Marketplace listing and reload the sheet.
- The add-on changed cells you did not expect. The listing warns it can act inside your spreadsheet. Restore from File > Version history.
For other Sheets automations, see how to send emails from Google Sheets automatically, log Gmail into a sheet with Apps Script or get Sheets alerts on WhatsApp. You can also connect Google Sheets to WhatsApp for free.
Is this allowed?
Yes, all three methods are supported routes, but think about what data you send. Anything in a prompt leaves your spreadsheet.
- The OpenAI listing says workbook content may be shared with Google and OpenAI. Do not use it on sheets holding customer, patient, student or other personal data unless your policy allows it.
- Google says Gemini output can be inaccurate or inappropriate and should not be relied on as medical, legal, financial or other professional advice. The add-on listing makes a similar point about financial, legal and tax advice.
- Do not paste your API key into a shared sheet or share the script with anyone you do not trust. Script Properties keep the key out of the code.
- Using AI to write exam answers or to get around a school or workplace rule is not covered here, and may break those rules.
What's still unclear?
Three things are not settled by the public pages.
- Plan eligibility for the add-on. The listing says Free and Go plans qualify, then tells users to sign in with the account tied to a Plus or Pro plan. Check the listing and your account before you plan around it.
=AI()availability. Google ties it to eligible plans, and says admin settings, language settings or Workspace Experiments participation can also block it, so it may not appear for you even on a paid plan.- Accuracy. Both OpenAI and Google warn that AI can make mistakes. For totals, tax figures or anything you will send to a client, check the numbers with a normal formula.
Last checked: 13 October 2026.
Frequently asked questions
Is there an official ChatGPT add-on for Google Sheets?
Yes. OpenAI publishes ChatGPT for Google Sheets on the Google Workspace Marketplace (listing updated 1 June 2026). After installing, you open it from Extensions > ChatGPT > Open, and it appears as a sidebar. You sign in with your ChatGPT account. Eligibility depends on your ChatGPT plan, so check the listing before installing.
Can I type =GPT() in a cell without an add-on?
Not by default. Sheets has no built-in =GPT() function. You can create one yourself with Apps Script, as shown in Method 3 above, which sends the cell text to the OpenAI API. Separately, Google has its own =AI() function powered by Gemini, which requires an eligible Google Workspace or Google AI plan.
Why does my custom GPT formula show #ERROR!?
Google requires a custom function to return within 30 seconds. If the model takes longer, the cell shows #ERROR! with the note 'Exceeded maximum execution time'. Shorten the prompt, ask for shorter answers, or choose a smaller model. Also check that your API key is saved under Script Properties with the exact name used in the code.
Does ChatGPT in Sheets see my whole spreadsheet?
It depends on the method. The OpenAI add-on is built to read and update your spreadsheet, so its listing says workbook content may be shared with Google and OpenAI. Google's =AI() function cannot see the whole sheet, only the range you pass in. The Apps Script formula sends only the text you give it.
Is my ChatGPT Plus subscription enough for the Apps Script method?
The Apps Script method calls the OpenAI API, which needs an API key and charges per token at the rates on OpenAI's pricing page. As of 13 October 2026 that page lists gpt-5-mini at $0.25 per million input tokens and $2.00 per million output tokens. Check OpenAI's billing pages for how your account is charged.
Sources
- ChatGPT for Google Sheets (Google Workspace Marketplace listing), Google Workspace Marketplace (listing by OpenAI) (2026-06-01)
- Use the AI function in Google Sheets, Google Docs Editors Help (2026-10-13)
- Custom Functions in Google Sheets, Google for Developers (2026-10-13)
- Properties Service, Google for Developers (2026-10-13)
- OpenAI API pricing, OpenAI (2026-10-13)
- OpenAI API quickstart, OpenAI (2026-10-13)