create_table_with_data
Generate and populate a table in Google Docs using a 2D list of data. Requires index from inspect_doc_structure for accurate document positioning. Ensures proper formatting and structure for reliable table creation.
Instructions
Creates a table and populates it with data in one reliable operation.
CRITICAL: YOU MUST CALL inspect_doc_structure FIRST TO GET THE INDEX!
MANDATORY WORKFLOW - DO THESE STEPS IN ORDER:
Step 1: ALWAYS call inspect_doc_structure first Step 2: Use the 'total_length' value from inspect_doc_structure as your index Step 3: Format data as 2D list: [["col1", "col2"], ["row1col1", "row1col2"]] Step 4: Call this function with the correct index and data
EXAMPLE DATA FORMAT: table_data = [ ["Header1", "Header2", "Header3"], # Row 0 - headers ["Data1", "Data2", "Data3"], # Row 1 - first data row ["Data4", "Data5", "Data6"] # Row 2 - second data row ]
CRITICAL INDEX REQUIREMENTS:
NEVER use index values like 1, 2, 10 without calling inspect_doc_structure first
ALWAYS get index from inspect_doc_structure 'total_length' field
Index must be a valid insertion point in the document
DATA FORMAT REQUIREMENTS:
Must be 2D list of strings only
Each inner list = one table row
All rows MUST have same number of columns
Use empty strings "" for empty cells, never None
Use debug_table_structure after creation to verify results
Args: user_google_email: User's Google email address document_id: ID of the document to update table_data: 2D list of strings - EXACT format: [["col1", "col2"], ["row1col1", "row1col2"]] index: Document position (MANDATORY: get from inspect_doc_structure 'total_length') bold_headers: Whether to make first row bold (default: true)
Returns: str: Confirmation with table details and link
Input Schema
Name | Required | Description | Default |
---|---|---|---|
bold_headers | No | ||
document_id | Yes | ||
index | Yes | ||
table_data | Yes | ||
user_google_email | Yes |