Google Sheets AI Formula

Google Sheets AI Formula

Does Google Sheets have an AI Formula?

No but you can add one.

Simple use Apps Script to add an AI formula to your sheets. You can use your own AI from Open AI and this comes out to be much cheaper than even $20 a month for ChatGPT at times. Depends on your use of AI.

I just updated Better Sheets' AI apps script to use Open AI Omni. Get the full script here.

Can I use ChatGPT in Google Sheets?

No but you can create ChatGPT in Google Sheets.

Let me show you!

But I need help with Google Sheets Formulas

I got you!

Try the AI Formula Generator by Better Sheets. You can enter any thing you want, and the range you're trying to do that to, and it'll figure out a formula for you.

It helps with combining formulas, getting the syntax right, and generally stretching what you can do with Google Sheets.

Google Sheets Formula Generator · Better Sheets
Generate formulas for use in Google Sheets. Helps you create formulas for Google Sheets. Face your formula frustrations head on. Solve your Google Sheets formula problems once and for all. Many formulas work in Excel too!

Go DEEP into AI

Go deeper and wider into how AI can be used in Google Sheets with my course Adventures in AI.

Adventures in AI
Functions and Fun! Transform Your Spreadsheets with OpenAI API and Apps Script. In this course I’ve tried to balance the fundamentals, foundations, and

Open AI Formula in Google Sheets

function ai(prompt) {
  var apikey = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("apikey").getRange("A1").getValue();
  var role = ""
  var data = {
  "model": "gpt-4o",
  "messages": [{"role": "system", "content": role},
                {"role": "user", "content": prompt }],
  "temperature": 1,
  "max_tokens": 500,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
}
  var options = {
    'method': 'POST',
    'contentType': 'application/json',
    'headers': {
      'Authorization' : 'Bearer ' + apikey
    },
    'payload': JSON.stringify(data)
  }
  var answer = UrlFetchApp.fetch("https://api.openai.com/v1/chat/completions",options)
  var response = answer.getContentText()
  var json = JSON.parse(response)
  return json.choices[0].message.content
}