Every hour, has ChatGPT write a fresh batch of the list you describe and adds each item as a row in your Google Sheet.
Uses
Google Sheets
OpenAI
Fill a spreadsheet with a ChatGPT-written list every hour
Describe what each item should be - 'quiz questions about world geography, each with its answer and a difficulty from 1 to 5' - and name the columns each item should fill. Every hour the workflow asks ChatGPT for that many items as a JSON array, one object per item with one key per column, reads the reply, and appends one row per item to your Google Sheet: the run's date and time first, then your columns in the order you listed them.
The reply is read defensively: code fences and any wording around the array are ignored, keys are matched whether or not ChatGPT changes their case or spacing, and a value it left out becomes an empty cell rather than a made-up one. Rows are only ever added, and values are written exactly as they arrived so none can become a formula. A reply that is not a list at all fails the run and says why, so an hour with no rows is never mistaken for a quiet one.
Before the first run, give the sheet a header row: 'Generated at' followed by your columns in the same order. Each run asks afresh, so over time similar items can come back; the first step sets how often it runs.
request to blank.Set request to blank.columns to blank.Set columns to blank.itemsPerRun to 5.Set itemsPerRun to 5.spreadsheetUrl to blank.Set spreadsheetUrl to blank.sheetName to Sheet1.Set sheetName to Sheet1.prompt to You are producing rows for a spreadsheet.Set prompt to You are producing rows for a spreadsheet.
Produce exactly itemsPerRun items. Each item is: request
Reply with a JSON array and nothing else: no introduction, no explanation and no Markdown code fences. Every element of the array is a JSON object with exactly these keys, spelled exactly as written and in this order: columns
Every value is plain text or a number - never an object or a list, and never left empty. Do not include the same item twice.prompt. Save it as answer.Ask OpenAI: prompt. Save it as answer.reply, columns, items_per_run, and generated_at and save it as parsed.Run Python code on reply, columns, items_per_run, and generated_at and save it as parsed.rows to parsed.rows.Set rows to parsed.rows.rows is emptyIf rows is emptyparsed.problem.Stop and report a problem: No rows were added. parsed.problem.rowsAdded to 0.Set rowsAdded to 0.row in rows:For each row in rows:sheetErrorIf a step below fails, save the error as sheetErrorsheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.rowsAdded.Add 1 to rowsAdded.rowsAdded of the length of rows row(s) to '@sheetName' before Google Sheets refused one. The remaining items from this batch were not added; once the sheet or its link is fixed, the next run adds a fresh batch. Google Sheets said: sheetError.message.Stop and report a problem: Added rowsAdded of the length of rows row(s) to '@sheetName' before Google Sheets refused one. The remaining items from this batch were not added; once the sheet or its link is fixed, the next run adds a fresh batch. Google Sheets said: sheetError.message.rowsAdded row(s) to '@sheetName'.Show in the output: Added rowsAdded row(s) to '@sheetName'.parsed.note isn't emptyIf parsed.note isn't emptyparsed.note.Show in the output: parsed.note.