Update rows one at a time so google app script one get overloaded

I have an app script bot that gets triggered on form save. The script makes calls to openAi to get some data. I have a several thousand rows that need to get back filled with the openAi data. If I make a bot that runs the script on a schedule, with so many rows, openAi stops my requests as it gets too many at once. I need a way where I can trigger the script to work down the sheet one row at a time - after all the cells are filled, it moves on to the next row and so on. This way, I won't face any rate limits with google or openAi. Any ideas how I could achieve this? 

0 2 109
2 REPLIES 2

Are you hitting a limit because of the number of rows in a single request or because there are too many back-to-back requests into openAi?

I'm not 100% sure, but openAi is telling me I've hit the max RPM. And if I watch the execution logs, all the rows are thrown at openAi almost simultaneously. 

Top Labels in this Space