Google Apps Script - ListItem Bullet Indentation Issue

Goal: Convert Unicode bullet characters () in a Google Doc to native Google Docs bullets via Apps Script, matching the exact spacing/indentation of the template’s existing native bullets.

Problem: The converted bullets display with different spacing than the template’s native bullets, even when using setIndentStart() and setIndentFirstLine() with values extracted from the template bullets themselves.

Current Approach:

javascript

const listItem = body.insertListItem(index, text);
listItem.setGlyphType(DocumentApp.GlyphType.BULLET);
listItem.setIndentStart(36);      // From template bullet
listItem.setIndentFirstLine(18);  // From template bullet

Result: The text position is correct, but the gap between the bullet point and text is visually different from template bullets.

Context:

  • Creating docs from template via Zapier

  • Placeholders get replaced with Unicode bullets

  • Apps Script webhook converts them post-creation

  • Template bullets were created manually in Google Docs

Question: What’s the correct way to programmatically create bullets that perfectly match native Google Docs bullet formatting? Is there another property/method I’m missing?

Multiple approaches attempted without success. Any suggestions appreciated!

Instead of just setting indents, you might also ensure that the LIST_ID is consistent. If you insert items without linking them to an existing list, Google Docs may treat them as new, standalone lists with default internal padding.

Thanks for the response! If I set the right list ID will it follow the same formatting as the list?

I think so … but I haven’t tried it myself, so caveat emptor. :slightly_smiling_face:

You might also try forcing the paragraph attributes to clear any Zapier-inherited “Left Indent”, which might be stacking on top of your bullet indents.

const style = {};
style[DocumentApp.Attribute.INDENT_START] = 36; style[DocumentApp.Attribute.INDENT_FIRST_LINE] = 18;
listItem.setAttributes(style);