Hoping I can get some advice on this. I'm using scripts to automate the creation of a document, where the data comes from an existing google doc. After no luck using linked tables, I'm trying to insert a table at a point identified by search text in the document.
For example, I'd search for TABLE1HERE in the document and replace it with a table defined by [[Heading,Data],[Heading2,MoreData]]. I've tried the below code and a number of variations with no luck. Any pointers would be fantastic.
function updateTablesTEST(searchText,replacementTable){
var document = DocumentApp.getActiveDocument();
var documentBody = document.getBody();
var textLocation;
var newPosition;
var textChild;
textLocation = documentBody.findText(searchText).getElement();
textChild = textLocation.getParent().getChildIndex(textLocation);
documentBody.insertTable(textChild+1, replacementTable);
}
TABLE1HEREputting in Document? For example, if this is putting in a table, it is required to modify the script for the situation. Can you provide a sample Document you want? 2. Can I ask you about the detail information ofI've tried the below code and a number of variations with no luck.? I think that providing such information will help users think of your issue. - Tanaike