0
votes

I'm new to google apps script and am trying to automatically change every document in a number of folders, going through each document file and where it has "88Name88" replace it with the name of the document

Is there anyway to do this?

I have tried "DocumentApp.getActiveDocument()" but that only works for one set document

1
You are only going to be able to update one file at a time. unless you want to try batching calls which is complicated and isnt going to give you any performance benefits as its still multiple calls on the server. - DaImTo
When you say 88name88 do you mean you have the real file name surrounded by 2 88s and you’re just removing the 88’s - Cooper
In the body of the document there is a name space which is called "88Name88" just so any other places it says "Name" isn't replaced - Alec

1 Answers

0
votes

Daisy Chaining the Script Calls

From a dialog or a webapp I think you could run a function that puts all of the document id's on a spreadsheet then returns some sort of a token to the dialog which then calls another function which goes and gets the first unchanged document id and makes the appropriate changes and then updates the spreadsheet that the document has been changed and returns a token to the dialog which lets the dialog know to call the function again and again until there are no remaining unchanged documents. This way the your only concern is that any one of these functions runs no longer than six minutes. I think this should work by using the onSuccessHandler to return the token to the dialogs javascript.