How to eliminate blank lines between bullet points in Google Docs

I’m working with a Google Docs document that has text formatted like this:

• item A• item B• item C

I want to convert it into proper bullet points without any empty lines between them:

  • item A
  • item B
  • item C

I created a Google Apps Script to handle this conversion:

function convertBullets() {
    var document = DocumentApp.getActiveDocument();
    var content = document.getBody();
    content.replaceText('• ', '\n');
}

The script runs fine, but when I select all text and apply bullet formatting, only the first line gets a bullet point. I think this happens because ‘\n’ doesn’t behave like pressing Enter manually.

I tried using ‘\r\n’ instead:

function convertBullets() {
    var document = DocumentApp.getActiveDocument();
    var content = document.getBody();
    content.replaceText('• ', '\r\n');
}

But this creates extra blank lines between each item, which is not what I want. How can I properly simulate pressing Enter so that each line becomes a separate bullet point when I apply list formatting?

Google Apps Script handles line breaks weird compared to actual paragraph breaks. When you use replaceText with ‘\n’, it creates soft breaks instead of real paragraphs that bullet formatting needs.

I ran into this exact problem when automating document formatting. Here’s what worked: use insertText() with deleteText() to rebuild everything properly. Find where all your bullets should go, delete the original text, then reinsert each item as its own paragraph using insertText() with real paragraph breaks.

Or try the Range API instead. Select each converted line individually and apply list formatting rather than selecting everything at once. You’ll get way better control and each item will format correctly.

The problem is Google Apps Script’s replaceText creates text nodes instead of actual paragraphs. I’ve hit this wall tons of times with document automation. Don’t use replaceText - split your text first, then rebuild it properly. Grab your content with getText(), split it on the bullet character in JavaScript, clear the body, and rebuild using appendParagraph() for each item. Something like: var items = body.getText().split('• '); Then loop through with body.appendParagraph(item) for each one. This creates real paragraph elements that bullet formatting actually recognizes. Way cleaner than hacking line breaks, and you won’t get those weird formatting glitches when applying list styles.

skip replacetext and go with insertparagraph() or insertpagebreak() instead. replacetext won’t give u actual paragraph breaks. you’ll probably need to loop through each item and insert paragraphs individually to get the bullet formatting workin right.