Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to populate an invoice.

I have a Google Spreadsheet that calculates hours per project, and I want to bring that into a Google Document, but despite much searching, have found no way to do this.

I thought importrange would work as a new equation, but no luck. how do you enter a formula into a Google Document?

share|improve this question
That can only be achieved though the usage of Google Apps Script. – Jacob Jan Tuinstra Feb 7 '14 at 22:06
jezz, and here I thought Import-range was going to work, ha! Okay. I'll get this cracking. Thankyou Jacob! – Eric Feb 7 '14 at 22:48

The following piece of code will create a Google Document and will insert a dynamic text, as a paragraph, into the newly created document. All is done from within a Google Spreadsheet.


// global
var ss = SpreadsheetApp.getActive();

function onOpen() {
  var menu = [{name: "Create Document", functionName: "createDoc"}];
  ss.addMenu("Extra", menu);

function createDoc() {
  var sh = ss.getActiveSheet(), aRow = sh.getActiveCell().getRowIndex();
  var title = sh.getRange(aRow, 1).getValue(), docDate = new Date(); 
  var docTitle = title + "-" + docDate, doc = DocumentApp.create(docTitle);

  // create text in document
  var body = doc.getBody();
  body.appendParagraph("A paragraph " + docTitle); 

  // create app and panel
  var app = UiApp.createApplication().setTitle("Open Google Document")
  var vPanel = app.createVerticalPanel()
    .add(app.createAnchor(docTitle, doc.getUrl()));

  // add to app


The code in your Google Spreadsheet, under Tools>Script editor. Press the bug button to authenticate the code and all is set to go.


I've created an example file for you: create Google Document with text

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.