Back to Salesforce Service Cloud in Google Sheets
SheetXAI logo
Salesforce Service Cloud logo
Salesforce Service Cloud · Google Sheets Guide

Create Parent Accounts With Nested Cases From a Google Sheet Using Composite Insert

2026-05-14
5 min read

The Scenario

You are three weeks into onboarding 15 new enterprise accounts. Each account needs to exist in Salesforce with 3 to 5 initial support cases already attached — the standard issues every new account opens in their first month. You have the whole structure in a Google Sheet: account names in column A, case subjects in columns B through F, one row per account.

Row-by-row API calls are not an option. With 15 accounts and up to 5 cases each, you are looking at 90 separate API requests if you do it the naive way — and Salesforce's API rate limits will make that painful.

The bad version:

  • Create the first Account via the API or UI, note the returned AccountId.
  • Create Case 1 linked to that AccountId, create Case 2, create Case 3.
  • Move to account 2, repeat.
  • Hit a rate limit around account 8, wait, resume, lose track of which accounts were completed before the error.

The composite sObject tree endpoint exists specifically for this scenario. But building the request payload manually — nesting cases as child records under each account in the correct tree structure — is not something you can do from a sheet without code.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Google Sheet. It reads the hierarchical structure from your rows and uses the Salesforce composite sObject tree endpoint to create parent Accounts with nested child Cases in a single API call per account.

Use Salesforce composite sObject tree insert to create each Account in column A along with its child Cases listed in columns B through F — one API call per account tree

What You Get

  • One composite sObject tree API call per account row, with the Account as the parent and each non-blank case subject in columns B through F as a nested child Case.
  • The generated Salesforce AccountId written back into your sheet for each successful account creation.
  • Child Case IDs written into adjacent columns so you have a full record of what was created and where it lives.
  • Rows that fail — invalid account names, missing required fields — get error notes written back instead of silently dropping.

What If the Data Is Not Quite Ready

Some accounts already exist in Salesforce — you only need the cases

You don't want duplicate accounts. You have existing Salesforce AccountIds in column G for some rows.

For rows where column G has a Salesforce AccountId, skip account creation and use that ID as the parent — create only the child Cases from columns B through F and write the Case IDs back into adjacent columns

The case subjects in columns B through F also have descriptions in a second table on another tab

Case creation needs both Subject and Description, which live across two tabs.

Join the account rows on this tab with the case description rows on the Cases tab using column A as the key, then build Salesforce composite sObject trees with each Account (column A) and its child Cases using the matched Subject and Description fields — write the generated IDs back

Some case columns are blank — only non-blank ones should become cases

Row 3 has entries in columns B, C, and D but columns E and F are empty.

For each row in this sheet, create a Salesforce composite sObject tree with the Account from column A and child Cases only for non-blank values in columns B through F — skip blank cells rather than creating empty-subject cases

Full tree creation with validation, blank filtering, and existing-account detection

Check whether the account already exists, skip creation if it does, create child cases only for non-blank subjects, and write all generated IDs back.

For each row: check whether an Account with the name in column A already exists in Salesforce — if it does, use that AccountId; if not, create the account via composite tree insert with non-blank child Cases from columns B through F. Write AccountId into column G and Case IDs into columns H through L.

One prompt handles the full hierarchical onboarding operation.

Try It

Get the 7-day free trial of SheetXAI and open your account onboarding sheet, then ask SheetXAI to run the composite tree inserts. For related reading, see the hub overview or the spoke on composite batch requests for handling bulk updates after records are created.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more