DavidR
DavidR

Reputation: 369

Two functions sequentially in google app script

I'm having this weird problem with my app script. I have two functions, one that processes text to remove line breaks and one that removes multiple spaces. When I manually run the two functions one after the other, the line break is removed and any multiple spaces are then removed where the line break was. But when I make a function like the following, the second function does not have any effect:

function bothTest() {
  cleanText();
  removeMultipleSpaces();
}

Surely this just runs the functions one after the other just as if I ran then manually. Why does it not have the same effect?

Upvotes: 1

Views: 2861

Answers (1)

HardScale
HardScale

Reputation: 1021

Try this:

function bothTest() { 
  cleanText();
  SpreadsheetApp.flush();
  removeMultipleSpaces();
}

Upvotes: 2

Related Questions