Google Spreadsheet + GPT3

Thanks for the prompt reply.

The issue is with my own script. I was wondering if you were experiencing a similar problem. I haven’t tried your script yet. If there is no problem, I can start using yours with some modifications.

1 Like

Hi @SilverH,
Maybe I can help you take a look at it? Do you mind sending over that to me?

1 Like

@nelson I have a solution to preserve outputs and prevent unnecessary burning of tokens. Would love to connect to share with you here. Also have a question for you about how you were able to leverage embeddings into google sheets. Thanks!


Hi all, just want to make a friendly reminder.
Some users have been getting issues on editing the Google Spreadsheet. Just wanted to say that by default the Google Spreadsheet is read-only, but you are more than welcome to make a copy of the google spreadsheet to your own drive and make any changes necessary.


Would be very grateful if you could share the solution to prevent unnecessary burning of tokens here!

1 Like

@songsofthespheres Are you using the newer version I posted here?

This one should not have any issues on burning tokens.
Also if you want to make sure, I added a new function call getCompletionsWithTimestamp
You can use this to test when was the last time the API executed.


Thanks Nelson. As far as I can tell, this now seems to be working for me!

I’ve noticed that the Search function only returns the entire text of the cell with the highest cosine similarity. Is there any way to make it so that the Search returns information from more than one cell (and not irrelevant information)?

I’m not much of a programmer so it is all a bit new to me. ChatGPT tells me I might consider using Named Entity Recognition based on spaCy, but wondering if you have any obvious workarounds.

What I am ultimately hoping to achieve is to fill the Sheets with my worldbuilding information then feed in relevant information into new prompts dynamically. Also, to have a summary cell for each category (e.g. a place) that I occasionally update using the Search function.

1 Like

Hi @songsofthespheres

I’m glad that you find it useful. As you mentioned, the search function was designed to only give you the result with the highest score. May I ask why the result with the highest score is giving you irrelevant information? I think we need to look into why that is happening, otherwise give you more results back might not help.

1 Like

Hi Nelson.

To give an example if cell one is ‘Alice is red’ and cell two is ‘Alice is tall’, when I ask ‘Describe Alex’ I get one or the other of those descriptors (red or tall) but never both. This is probably not a use that you intended the sheet to cover.

The reason Alice might be variously described in my use is because things in my world might be related. For example, a city may be mentioned in the context of more than one entry relating to a faction.

It may be that the solution is not in the code as such but in how I organise the data.

1 Like

Sorry Nelson, just to add on the irrelevancy part. There may be information within the cell that is not relevant to the query. I was hoping to break down the token limit by only extracting that piece of information that is relevant. But it occurs to me that I can probably do this with an intermediate query, then feed the extracted information into the final prompt.

1 Like

Hi @songsofthespheres1

Yes, I agree, I think your use cases might be a bit more complicated than the current spreadsheet can handle, because if we add additional search results, then you will have to measure the number of tokens so the prompt doesn’t exceed the max. I am currently working on a more robust solution that handle multiple documents and embedding. If you are interested I can show you how that works and see if it can help you solve this problem. Feel free to PM or connect with me on linkedin if you like, thanks.

1 Like

Can we fine tune GPT 3 model using google app script ?

Hi @notifications
The gsheet is currently used for managing data between the Embeddings API and Completion API. Currently it is not designed for the FineTuning API. From my experience most uses cases don’t need the Fine Tuning API, what are you looking to do with OpenAI’s API library?

Thank you Nelson for a quick reply

I have made an end to end app using google app script as backend language and used app sheet for front end and google sheet for database.

Now I have already integrated the app with Open AI api for some of the use case.

Now I want to fine tune the model with the data captured by the app during the operation of the business.

I have never worked on python the only language I know is google app script.

Hi @notifications
For the fine tuning API, I don’t have plan on integrating with the current Google Sheet at the moment but you can follow the direction here to do it. OpenAI API

Hi Nelson,
I already trained my model by reading documentation and steps and all instructions related doubts were asked to Chat GPT itself. Learning is so easy with the help of AI… it is substantially increasing implementation process.

Thank you for your time.

Glad to hear you have made progress in such a short time. Well done!!!

I am trying to use your script and am getting an error as if the default API key of “xxxx” is still in use. The API key is valid because I have another Gsheet that makes calls to OpenAPI and it works.
ScreenHunter 3783

After you modify the API key it won’t trigger the function yet.
Have you tried updating the cells with the input?

I tried to troubleshoot it. In the end, I found another Google Sheet that worked.