TASK_SPLIT

TASK_SPLIT

Function Overview

TASK_SPLIT is a custom function that intelligently splits a text file into logical sections using AI. It analyzes your document, identifies natural division points based on your instructions, and creates separate Google Docs for each section. Each section is then accessible via automatically created hyperlinks in your spreadsheet.

Uses

  1. Break long reports into chapter-by-chapter Google Docs for easier navigation
  2. Split technical documentation into logical sections by topic
  3. Divide large text files into manageable chunks for collaborative editing
  4. Extract specific sections from lengthy documents based on content themes
  5. Convert lengthy meeting notes into topical sections for better organization
  6. Separate code files into functional components with proper documentation
  7. Create a table of contents with links to each section of a document
  8. Split research papers into methodology, findings, and conclusion sections

Syntax and Parameters

=TASK_SPLIT(header, file_link_cell, prompt, model, [celladdress])

Parameter Data Type Required Description
header string Yes Column header for the task template
file_link_cell string Yes Cell containing a link to the text file to split (e.g., "A1")
prompt string Yes Instructions describing how to split the file into sections
model string Yes The model name in the format 'provider/model_name' (e.g., "Gemini/gemini-1.5-pro")
celladdress string No The cell address to place the first section link (if omitted, places in cell to the right of the function)

Advanced Options

Model Selection

The model parameter allows you to select any AI model available in your Sheet Workflows configuration. For best results with complex document structures, use more powerful models like:

  • "Anthropic/claude-3-sonnet"
  • "Gemini/gemini-1.5-pro"
  • "OpenAI/gpt-4o"

Splitting Instructions

The prompt parameter is crucial for getting good results. Be specific about:

  • What constitutes a section (chapters, topics, headings, etc.)
  • How to handle nested sections
  • Whether to include section headings in each document
  • Minimum/maximum section sizes

Output Cell Placement

The optional celladdress parameter lets you control where section links appear:

  • Specific cell address (e.g., "C5")
  • Column-only notation (e.g., "C") - uses same row as function
  • If omitted, links start in the cell to the right of the TASK_SPLIT formula

Examples

Example 1: Split a report into chapters

=TASK_SPLIT("Split Report", "A1", "Split this document into chapters. Each chapter starts with 'Chapter X' and should be a separate section.", "Anthropic/claude-3-sonnet", "C1")

When run, this splits the document linked in cell A1 into chapters and places links to each chapter starting at cell C1.

Example 2: Split technical documentation by topic headers

=TASK_SPLIT("API Documentation Sections", "B5", "Split this documentation by level 2 headings (## in markdown). Each section should include its heading.", "Gemini/gemini-1.5-pro")

When run, this splits the document linked in cell B5 by level 2 markdown headings and places links in the cell to the right of the formula.

Example 3: Extract specific topics from a meeting transcript

=TASK_SPLIT("Meeting Topics", "D3", "Identify and extract discussions about: 1) Project Timeline, 2) Budget Concerns, 3) Technical Challenges, and 4) Next Steps. Create a section for each topic.", "OpenAI/gpt-4o", "E3")

When run, this analyzes the transcript linked in cell D3, identifies content related to each topic, and creates a separate document for each topic with links starting at E3.

Best Practices

  • Provide clear, specific instructions in the prompt parameter for better splitting accuracy
  • Use more powerful models for complex documents or when precise section identification is important
  • Check that the file link in file_link_cell is properly accessible before running
  • For lengthy documents, ensure the model you select can handle the content length
  • Create a dedicated area in your spreadsheet for the section links that won't be overwritten
  • Use descriptive headers in your formula to clearly indicate what is being split
  • Test your splitting instructions on small documents first to verify they produce the expected sections
  • Consider file size limitations - extremely large files may need to be pre-split before using TASK_SPLIT
  • Remember to select the TASK_SPLIT cell and click "Run" in the Sheet Workflows sidebar to execute
  • Review the generated sections to ensure the splitting worked as expected

Troubleshooting

Error: "File content could not be retrieved"

Cause: The cell referenced by file_link_cell doesn't contain a valid file link, or the file is inaccessible.
Solution: Verify the file link is correct and that you have access permissions to the file.

Error: "LLM failed to process the content"

Cause: The language model encountered an error processing your document.
Solution: Try a more powerful model or reduce the file size. Also check that your instructions are clear.

Error: "Invalid JSON returned from language model"

Cause: The language model couldn't properly format its response for section identification.
Solution: Simplify your splitting instructions or try a different model.

Error: "Missing parameters"

Cause: Required parameters like file_link_cell or prompt are missing.
Solution: Ensure all required parameters are provided in your formula.

Error: "Invalid cell address"

Cause: The celladdress parameter contains an invalid cell reference.
Solution: Use a valid A1 notation cell reference like "C1" or column letter like "C".

Nothing happens when the formula is entered

Cause: TASK_SPLIT only creates instructions; it doesn't execute until run.
Solution: Select the cell containing the TASK_SPLIT formula and click the "Run" button in the Sheet Workflows sidebar.

FAQ

How large of a document can TASK_SPLIT handle?

TASK_SPLIT can handle documents up to several megabytes in size, but performance and accuracy depend on the model used. For very large documents, consider pre-splitting into smaller files.

What file formats can TASK_SPLIT process?

TASK_SPLIT works with plain text files, markdown documents, and Google Docs via their file links. It's designed primarily for text-based content.

Where are the split section documents saved?

The sections are saved as individual Google Docs in your Google Drive, typically in a folder named "sheetworkflows/docs/". Each document will have the section name as its title.

Can I customize how the sections are named?

Yes, through your prompt instructions. For example: "Split by chapters and name each section 'Chapter X: [chapter title]'".

Does TASK_SPLIT support splitting by specific keywords?

Yes, you can instruct the AI to split the document wherever certain keywords or phrases appear by specifying this in your prompt.

Can I see a preview of how the document will be split before creating all the files?

No, there's no preview functionality. However, you can test your splitting instructions on a smaller portion of your document first.

How accurate is the splitting?

The accuracy depends on the clarity of your instructions, the document structure, and the capability of the selected language model. More powerful models and clear section boundaries yield better results.

Can TASK_SPLIT handle code files?

Yes, you can split code files into logical sections, though you should specify in your prompt how to handle code blocks appropriately.

What happens if the AI can't find clear section boundaries?

If the AI can't confidently identify sections based on your instructions, it will make its best attempt based on content organization. Check the results to ensure they meet your needs.

Can I use the split sections in other Sheet Workflows functions?

Yes, each section is saved as a Google Doc with a link in your spreadsheet, which can be used with other functions like TASK_MARKDOWN_TO_DOC or TASK_DOC_TO_MARKDOWN.

Elisha

1 week ago

Categories
Features