I work with Google docs that contain hundreds of blank paragraphs. I want to delete these empty lines automatically.
In LibreOffice Writer, you can use the Find and Replace tool to replace ^$with anything, but this did not work in Google Docs.
My search ^$or ^\s*$returned 0 results, although there should be 3 matches
How to delete blank paragraphs using Google Apps Script?
I already tried body.findText("^$");but returnsnull
function removeBlankParagraphs(doc) {
var body = doc.getBody();
result = body.findText("^$");
}
source
share