![chat in google sheets chat in google sheets](https://cdn.arstechnica.net/wp-content/uploads/2020/10/63.jpg)
In a blank page on your sheet (NOT the settings one…) create two column headers called PROMPT and RESPONSE. This is telling the script to take the API key from cell A3 of the Settings sheet that you just made. Make sure this is in the ‘Settings’ sheet or it won’t work!įinally, delete the double forward slashes from the start of lines 25 and 26 or the Apps Script File and add double slashes to the start of line 29. Within that new settings page, paste your API key into the cell A3, adding an optional label(s) if required: This method is much better if you want to share your spreadsheet or create copies of it for others to use with their own API key without having to edit the code.įirst, create a new page within your existing sheet and call it settings Only use this method if you do not plan to share your sheet or Apps Script with anyone else. You should not share your API key with anyone, as they can abuse all your credits and potentially cost you money. If you use this method, you should not share your Google Sheet with others, as this will also share the Apps Script file that contains your API Key. On line 29 of the Apps Script file, find YOUR_API_KEY and replace it with your API that you got in step 1. There are two ways to do this, both of which are possible with the code provided in the Gist above.
![chat in google sheets chat in google sheets](https://logosmarcas.net/wp-content/uploads/2022/04/Google-Chat-Logo.png)
Step 6: Add Your OpenAI API Key to Google Sheets It may ask you to sign-in to Google again to authorise the script to run. You can enter a description if you like, then click deploy. Use the blue Deploy button in the top right corner. If you cannot see the code – view it on GitHub instead (opens in a new tab). Var result = JSON.parse(response.getContentText()) var apiKey = setsh.getRange(3,1).getValue() //Cell A3 var setsh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Settings") EITHER get API key from settings sheet main function to generate the custom formula (=CHAT) Ss.getRange(1,1,data.length,data.length).setValues(data) SpreadsheetApp.getUi().showModalDialog(ui, "Redirecting.") addItem("ChatGPT API Sheet by Sarah Tamsin □", "openUrl")Ĭonst html = "window.open('" + url + "', '_blank') () " Ĭonst ui = HtmlService.createHtmlOutput(html) addItem("□ Save Responses as Text", "saveAsText") Paste in the following code: // Add ChatGPT Menu Luckily, this is the part I’ve done for you!ĭelete all of the existing text in the new Apps Script file that says function myFunction() and the pair or curly brackets. You should see the blank file which will open itself in a new tab: Step 4: Create Your Apps Script Code In the Google Sheets menu, go to Extensions > App Script This is the easy step! Step 3: Create An Apps Script Make sure you’re signed into your Google account, then visit and create a new blank sheet. Once you click ‘Create a new secret key’ – you will only be shown it once, so copy and save it right away, or you’ll have to create a new one.
![chat in google sheets chat in google sheets](https://imag.malavida.com/mvimgbig/download-fs/hangouts-chat-20819-1.jpg)
You can generate approximately 750,000 words for $2. You can get one from OpenAI’s website, which comes with $18 worth of free credit (enough to generate approximately 670,000 words).Īfter that, the cost is $0.002 per token. Lifetime Access – $27 How To Integrate ChatGPT With Google Sheets □įollow this step-by-step guide: Step 1: Get An OpenAI API Keyīefore getting started, you’ll need an OpenAI API Key. There are already dozens of different Google Sheets that have been integrated with OpenAI’s API, but until now, we couldn’t connect it directly to ChatGPT, but now we can! It’s extremely flexible as you can connect your spreadsheets to external services using JavaScript in an Apps Script file. SEO Professionals, digital marketers and data analysts love Google Sheets. Integrate ChatGPT with third party tools, including custom-made apps and existing tools like Google Sheets.Sending multiple prompts at once (the web interface for ChatGPT only allows one prompt at a time).Faster responses from ChatGPT (the website is often slow).In short, we can do more with it, such as: This article will show you exactly how to integrate ChatGPT with Google Sheets, including a free script you can use in your own Google Sheet today! What Does the ChatGPT API Mean For Us? Obviously, after I received the email, I stayed up until the early hours integrating ChatGPT’s API into my existing Google Sheets that I’ve already been using with OpenAI’s API. Step 6: Add Your OpenAI API Key to Google Sheets.How To Integrate ChatGPT With Google Sheets □.Get Your Ready Made Google Sheet Right Here.