0

As per below screenshot, I have a Doc called "Raw". All I need to copy/append this doc pages to other of the Documents like "Document 1, 2, 3...." at the end of its pages using Google script editor ?

enter image description here

This is my code, am able to achieve this only for text contents, but not as whole page with charts, shapes, formatting, images, etc.

function myFunction() {
  
  var SOURCE_FILE = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" //Browser Document ID;
  var DESTINATION_FILE = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  
  var SOURCE_FILE_COPY = DocumentApp.openById(SOURCE_FILE).getText();
  //var DESTINATION_FILE_COPY = DocumentApp.getActiveDocument().getBody();
  var DESTINATION_FILE_COPY = DocumentApp.openById(DESTINATION_FILE).getBody();
  var TEXT = DESTINATION_FILE_COPY.editAsText();
  TEXT.appendText(SOURCE_FILE_COPY);      
}
M.S. Arun
  • 1,053
  • 13
  • 22
  • Does this answer your question? [How can I generate a multipage text document from a single page template in google-apps-script?](https://stackoverflow.com/questions/10692669/how-can-i-generate-a-multipage-text-document-from-a-single-page-template-in-goog) – Rafa Guillermo Jun 30 '20 at 09:38
  • Thanks @RafaGuillermo, as i mentioned in my question, I need entire contents of google docs page without losing its formatting(charts, shapes, formatting, images, etc.). The link which you provided only for text and paragraphs, which i already had achieved that. – M.S. Arun Jul 01 '20 at 15:52
  • Have you actually tried using it? It *keeps* all those things you say you want to keep. – Rafa Guillermo Jul 02 '20 at 10:49
  • @RafaGuillermo, This link "https://stackoverflow.com/questions/10692669/how-can-i-generate-a-multipage-text-document-from-a-single-page-template-in-goog" worked only for Paragraphs and List Items, but the Table elements lost their formatting. – M.S. Arun Jul 03 '20 at 10:38

0 Answers0