Writes each planned topic with AI, saves it to WordPress as a draft, and records the link in your sheet.

UsesGoogle SheetsOpenAIWordPress

Turn a content plan into WordPress drafts

ScheduleRun every day.Run every day.
ValuesSet planSpreadsheetUrl to blank.Set planSpreadsheetUrl to blank.
ValuesSet planTabName to blank.Set planTabName to blank.
ValuesSet audienceAndStyle to blank.Set audienceAndStyle to blank.
ValuesSet draftLogTabName to Drafted Posts.Set draftLogTabName to Drafted Posts.
ValuesSet maxNewDraftsPerRun to 5.Set maxNewDraftsPerRun to 5.
Decisions & LoopsIf a step below fails, save the error as draftLogTabErrorIf a step below fails, save the error as draftLogTabError
Try
Google SheetsGoogle SheetsCreate the tab draftLogTabName in planSpreadsheetUrl.Create the tab draftLogTabName in planSpreadsheetUrl.
On error
ValuesShow in the output: Did not create the '@draftLogTabName' tab, which is expected once it exists: draftLogTabError as text.Show in the output: Did not create the '@draftLogTabName' tab, which is expected once it exists: draftLogTabError as text.
Google SheetsGoogle SheetsRead the rows of planSpreadsheetUrl. Save it as draftLog.Read the rows of planSpreadsheetUrl. Save it as draftLog.
Decisions & LoopsIf draftLog.headers is emptyIf draftLog.headers is empty
Yes
Google SheetsGoogle SheetsAdd a row to draftLogTabName in planSpreadsheetUrl.Add a row to draftLogTabName in planSpreadsheetUrl.
No
No steps
ListsStart an empty list and save it as alreadyDrafted.Start an empty list and save it as alreadyDrafted.
Decisions & LoopsFor each loggedPost in draftLog.rows:For each loggedPost in draftLog.rows:
Decisions & LoopsIf a step below fails, save the error as loggedTopicErrorIf a step below fails, save the error as loggedTopicError
Try
ListsAdd loggedPost.Topic in lowercase to the end of alreadyDrafted and save it as alreadyDrafted.Add loggedPost.Topic in lowercase to the end of alreadyDrafted and save it as alreadyDrafted.
On error
ValuesShow in the output: Ignoring a row in '@draftLogTabName' that has no Topic.Show in the output: Ignoring a row in '@draftLogTabName' that has no Topic.
Google SheetsGoogle SheetsRead the rows of planSpreadsheetUrl. Save it as plan.Read the rows of planSpreadsheetUrl. Save it as plan.
ValuesSet newDrafts to 0.Set newDrafts to 0.
Decisions & LoopsFor each plannedPost in plan.rows:For each plannedPost in plan.rows:
Decisions & LoopsIf newDrafts is greater than or equal to maxNewDraftsPerRunIf newDrafts is greater than or equal to maxNewDraftsPerRun
Yes
ValuesShow in the output: Reached this run's limit of new drafts. The rest of the plan is picked up on the next run..Show in the output: Reached this run's limit of new drafts. The rest of the plan is picked up on the next run..
Decisions & LoopsStop repeating.Stop repeating.
No
No steps
ValuesSet topic to blank.Set topic to blank.
Decisions & LoopsIf a step below fails, save the error as topicErrorIf a step below fails, save the error as topicError
Try
TextTrim plannedPost.Topic and save it as topic.Trim plannedPost.Topic and save it as topic.
On error
ValuesShow in the output: Skipping a row in '@planTabName' that has no Topic.Show in the output: Skipping a row in '@planTabName' that has no Topic.
Decisions & LoopsIf topic is emptyIf topic is empty
Yes
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
Decisions & LoopsIf alreadyDrafted contains topic in lowercaseIf alreadyDrafted contains topic in lowercase
Yes
ValuesShow in the output: Already drafted, skipping: topic.Show in the output: Already drafted, skipping: topic.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet angle to blank.Set angle to blank.
Decisions & LoopsIf a step below fails, save the error as angleErrorIf a step below fails, save the error as angleError
Try
TextTrim plannedPost.Angle and save it as angle.Trim plannedPost.Angle and save it as angle.
On error
ValuesChange angle to blank.Change angle to blank.
ValuesSet brief to Topic: topic.Set brief to Topic: topic.
Decisions & LoopsIf angle isn't emptyIf angle isn't empty
Yes
ValuesChange brief to briefChange brief to brief Angle to take: angle.
No
No steps
ValuesSet prompt to You are writing one post for a company blog.Set prompt to You are writing one post for a company blog. Audience and house style: audienceAndStyle brief Write the finished post body. Return ONLY the body HTML - <h2>, <h3>, <p>, <ul> and <li> tags. Do not include an <h1>, a title line, a code fence, or any commentary before or after the HTML. Aim for 600-900 words, use concrete examples, and do not invent statistics, quotes, customer names, or links.
ValuesSet draftHtml to blank.Set draftHtml to blank.
Decisions & LoopsIf a step below fails, save the error as writingErrorIf a step below fails, save the error as writingError
Try
TextTrim the response text from the OpenAI “Ask OpenAI” step and save it as draftHtml.Trim the response text from the OpenAI “Ask OpenAI” step and save it as draftHtml.
On error
ValuesShow in the output: Could not draft '@topic': writingError as text.Show in the output: Could not draft '@topic': writingError as text.
Decisions & LoopsIf draftHtml is emptyIf draftHtml is empty
Yes
ValuesShow in the output: No draft text came back for '@topic'. It stays on the plan for the next run.Show in the output: No draft text came back for '@topic'. It stays on the plan for the next run.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet newPost to nothing.Set newPost to nothing.
Decisions & LoopsIf a step below fails, save the error as wordpressErrorIf a step below fails, save the error as wordpressError
Try
WordPressWordPressCreate the post topic. Save it as newPost.Create the post topic. Save it as newPost.draftHtml
On error
ValuesShow in the output: Could not create the WordPress draft for '@topic': wordpressError as text.Show in the output: Could not create the WordPress draft for '@topic': wordpressError as text.
ValuesSet postUrl to blank.Set postUrl to blank.
Decisions & LoopsIf a step below fails, save the error as postLinkErrorIf a step below fails, save the error as postLinkError
Try
TextTrim newPost.link and save it as postUrl.Trim newPost.link and save it as postUrl.
On error
ValuesChange postUrl to blank.Change postUrl to blank.
Decisions & LoopsIf postUrl is emptyIf postUrl is empty
Yes
ValuesShow in the output: No WordPress draft was created for '@topic'. It stays on the plan for the next run.Show in the output: No WordPress draft was created for '@topic'. It stays on the plan for the next run.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
Google SheetsGoogle SheetsAdd a row to draftLogTabName in planSpreadsheetUrl.Add a row to draftLogTabName in planSpreadsheetUrl.
ListsAdd topic in lowercase to the end of alreadyDrafted and save it as alreadyDrafted.Add topic in lowercase to the end of alreadyDrafted and save it as alreadyDrafted.
ValuesAdd 1 to newDrafts.Add 1 to newDrafts.