Automating bulk prompting with spreadsheets
In the previous chapters, we explored creating social media posts (Chapter 2) and performing sentiment analysis, data classification, and data cleaning (Chapter 5). For these types of tasks, which are often performed for multiple records, prompting an LLM manually on a case-by-case basis can be tedious and inefficient.
While tools such as ChatGPT, Bard, and Claude 2 allow the usage of variables, you still need to copy and paste input text to process it through the LLM. Then, you have to copy the model’s output and paste it into a spreadsheet or another document.
Rather than manual prompting, it’s better to automate these workflows. By integrating your LLM with Google Sheets using Apps Script, you can create custom formulas that automatically rerun prompts on many inputs in bulk.
For example, you could write a formula such as =AI_GPT(A2)
that takes the text from cell A2, sends it to the GPT-3/4 API, and returns the response...