Use OpenAI with Google Spreadsheets

Use OpenAI with Google Spreadsheets

This article explains how you can integrate OpenAI GPT-3 with Google Spreadsheets. This allows you to complete spreadsheet tasks with the use of AI.

Pre-requisites

  • Google Spreadsheet
  • Script to connect with OpenAI API
  • OpenAI account with free credits/ paid subscription



Guidelines to complete integration

OpenAI API Key Generation

  • Go to https://beta.openai.com/account/api-keys
  • Click on the 'Create new secret key' button
  • Copy and save somewhere the generated key. This is shown onetime only, and you cannot view the full key later. Or you will have to generate a new key, if you forgot the existing key.

No alt text provided for this image

API function used to connect to OpenAI

  • Click on the below link and save it or copy the script.

Tip: Make sure to subscribe to above Gist since all future revisions with improvements will be made to this file. Then you can refer to this file later and update your functions.

No alt text provided for this image

Creating a Spreadsheet and connect the API function

  • Go to https://docs.google.com/spreadsheets and create or use an existing Spreadsheet.
  • Using the menu bar, go to Extensions > Apps Script. This will open a new tab.
  • You can use the macros.gs file or use + button to add a new Script file.
  • Copy and paste the API function?mentioned in previous topic.
  • Now click 'Save' button. You will notice an error. It's because, you have to replace ENTER YOUR SECRET KEY HERE TAKEN FROM OPEN_AI with your generated API Secret Key.

Example code after modification:

const SECRET_KEY = "sk-c0rXVe6m5UaT7Bd7hwcZT0BlbkFJMnBRSwgOat40SVstiJA1";
	        

  • Now try saving the project again. You will not see any errors. Now you can close this tab since functions are ready to be used.

No alt text provided for this image

Note: When there are revisions to functions in the Gist file we discussed above, this is the same place you need to update the new revised code as well.

Use the OpenAI for Spreadsheet taks

Now that you have connected the OpenAI and Spreadsheet, you can start using below functions. (New functions will be updated in the Gist in future)


OPEN_AI(prompt, precision, model, max_tokens)        



OPEN_AI_CATEGORIZE(category_list, category_value_list, input, rules = [])        
No alt text provided for this image
No alt text provided for this image


Video tutorial




Follow Nimesh Ekanayake ?on LinkedIn


#OpenAI?#AI?#ArtificialIntelligence?#DeepLearning?#MachineLearning?#NaturalLanguageProcessing?#Robotics?#NeuralNetworks?#Tech?#Innovation?#FutureTech?#AIresearch?#OpenAIresearch?#GPT3 #LanguageModel #NaturalLanguageProcessing #NLP #DeepLearning #AIchatbot #AIassistant #AItechnology #AIinnovation

要查看或添加评论,请登录

Nimesh Ekanayake的更多文章

  • ChatGPT-4: The Next Generation AI Chatbot

    ChatGPT-4: The Next Generation AI Chatbot

    1. Introduction to ChatGPT-4 What is ChatGPT-4? ChatGPT-4 is the next-generation AI chatbot developed by OpenAI, which…

  • Microsoft Edge + Microsoft AI-powered Bing Search - Feature Review

    Microsoft Edge + Microsoft AI-powered Bing Search - Feature Review

    Microsoft Edge and Microsoft Bing AI offer a content summarizing feature that aims to make it easier for users to…

  • Internet Down!? Here's how to solve it...

    Internet Down!? Here's how to solve it...

    WhatsApp launched a new feature in 2023 as a solution for Internet shutdowns happening around the globe by governments.…

  • Future of Authentication: Passkeys

    Future of Authentication: Passkeys

    Passkey technology is a type of authentication system that uses a unique code or "key" to grant access to a secure…

  • What is Web3?

    What is Web3?

    Web3 refers to the third generation of the World Wide Web, which is focused on the development of decentralized…

  • Guidelines for a Better CV

    Guidelines for a Better CV

    A CV (curriculum vitae) is a document that outlines your education, skills, and experience. It is typically used to…

  • Difference Between RenderPartial and RenderAction

    Difference Between RenderPartial and RenderAction

    RenderPartial and RenderAction are two methods in the ASP.NET MVC (Model-View-Controller) framework that allow you to…

  • Difference Between Covariance and Contravariance

    Difference Between Covariance and Contravariance

    Covariance and contravariance are concepts in computer science that describe the relationship between two types. These…

  • Using Abstract Methods in a Derived Class

    Using Abstract Methods in a Derived Class

    An abstract method is a method that is declared in a base class but does not have an implementation. It is used to…

  • SOLID Principles in Object-Oriented Programming (OOP)

    SOLID Principles in Object-Oriented Programming (OOP)

    In object-oriented programming, there are several principles that are followed in order to design and implement…

社区洞察

其他会员也浏览了