• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer
    • 🔥 Pabbly Chatflow — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

Pabbly Text Formatter not cleaning up \n

Rey

Member
Your Workflow URL
https://connect.pabbly.com/task/history?filter_status=applied&filter_by_workflow_id=IjU3NjYwNTY1MDYzMTA0MzU1MjY1NTUzMzUxMzMi_pc
Your Task History ID
https://connect.pabbly.com/task/history?filter_status=applied&filter_by_workflow_id=IjU3NjYwNTY1MDYzMTA0MzU1MjY1NTUzMzUxMzMi_pc#
Consent to Access & Modify
I authorize Pabbly Support to log in to my account and make changes to the specified workflow for troubleshooting.
Pabbly Text Formatter not working correctly to clean up \n from a Google Doc.

Here's the workflow:

Workflow Summary: Google Doc AI Formatter

Objective: Automatically reformat new Google Docs from a "wall of text" into professionally structured reports using AI.

Trigger:

  • Google Drive: New File in Specific Folder
    • Initiates the workflow when a new document is added to a monitored folder.
Step 1: Data Extraction

  • Google Drive: Get File Content
    • Action: Extracts raw, unformatted plain text from the triggered Google Doc.
    • Output: Text string containing native newline characters (\n).
Step 2: Text Preprocessing

  • Text Formatter: Replace Text
    • Action: Finds all newline characters (input via Enter key in UI) and replaces them with a single space.
    • Purpose: Converts the text into a continuous block, removing artificial line breaks to optimize it for AI processing.
Step 3: AI Processing

  • OpenAI: Create Conversation (Completion)
    • Action: Sends the preprocessed text to the GPT-4 API with a strict system prompt.
    • Prompt Instructions: Command the AI to act as an editor—preserving all original content exactly while adding logical structure (H1, H2, bullet lists, paragraphs). Output must be valid HTML.
    • Output: Returns a JSON response containing the reformatted text as clean HTML.
Step 4: Document Creation

  • Google Docs: Create Document From Text
    • Action: Takes the HTML output from the OpenAI step.
    • Configuration: Content Type is set to "HTML".
    • Result: Creates a new Google Doc where the HTML tags are automatically rendered into native Google Docs styles (Headings, lists, etc.).
Final Output: A new, professionally formatted Google Doc, generated automatically from the original unstructured text.

After this, I will add an workflow step that emails this report.
 

Attachments

  • Screenshot 2025-09-26 101833.png
    Screenshot 2025-09-26 101833.png
    35.6 KB · Views: 4

ArshilAhmad

Well-known member
Staff member
Hi @Rey,

The screenshot appears to be from your Google Docs document, and it seems you are directly passing the response from OpenAI to Google Docs. We suggest adding a Text Formatter step between these two steps to remove the '\n', and then pass the result from the Text Formatter to the Google Docs action step. This should help resolve your issue.
1758912104379.png
 
Top