---
title: "Discussion on \"Unleash the Power of GPT-4 API & Google Sheets: A Step-by-Step Guide to Integration\" | Hashnode"
description: "Discussion on \"Unleash the Power of GPT-4 API & Google Sheets: A Step-by-Step Guide to Integration\". Discover how to harness the power of GPT-4 API and Google Sheets to automate tasks and revolutionize your data-driven workflows. Step-by-step guide."
url: "https://hashnode.com/posts/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration/641bd1de108a964a86a391f1"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Unleash the Power of GPT-4 API & Google Sheets: A Step-by-Step Guide to Integration](https://blog.futuresmart.ai/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration?utm_source=hashnode&utm_medium=feed)

Discover how to harness the power of GPT-4 API and Google Sheets to automate tasks and revolutionize your data-driven workflows. Step-by-step guide.

Mar 23, 2023 · 10 min read · blog.futuresmart.ai  
Read the article

-   [#google-sheets](https://hashnode.com/tag/google-sheets)
-   [#automation](https://hashnode.com/tag/automation)
-   [#chatgpt](https://hashnode.com/tag/chatgpt)
-   [#gpt-4](https://hashnode.com/tag/gpt-4)
-   [#generative-ai](https://hashnode.com/tag/generative-ai)

## Written by

[Krishna Chaitanya](https://hashnode.com/@krishnachaitanya1)

@krishnachaitanya1

  
[View profile](https://hashnode.com/@krishnachaitanya1)

## Responses 1

Markdown supported · ⌘↵ to post

[Peter Keyse](https://hashnode.com/@theScribe)

[Sep 24, 2023](https://hashnode.com/posts/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration/641bd1de108a964a86a391f1/comment/6510097d3dd903406188bfce)

Very nicely written Krishna Chaitanya

May I share a thought on using the messages array with OpenAI's gpt-4 and gpt-3.5-turbo APIs. I use messages to help maintain conversational flow by recycling the chat history and adding an NLP analysis.

messages: \[ { role: "system", content: topic },

{ role: "assistant", content: LastPrompt },

{ role: "assistant", content: LastResponse },

{ role: "user", content: Get("Keywords") },

{ role: "user", content: Get("Entities") },

{ role: "user", content: Get('Summary') },

{ role: "user", content: Get('GPT\_Ideas') },

{ role: "user", content: prompt }, \]

Topic, LastPrompt, LastResponse, Keywords, Entities, Summary and new Ideas are ranges in the sheet and are used to prime the follow-up prompt. The NLP is generated by the Do\_NLP\_Analysis() executed prior to sending the prompt to the LLM.

function Do\_NLP\_Analysis() {

// generate an NLP analysis

Keywords = Do\_Keywords() // uses fast-gpt-j

Summary = Do\_Summary() // uses finetuned-gpt-neox-20b or Cohere Summarization

Entities = Do\_Entities() // uses Google Cloud Natural Language

Ideas = Do\_Ideas() // uses either gpt-4 or gpt-3.5-turbo

return; }

Get() is a simple library function that gets the value of a range in the sheet.

It works for me.
