Get text from a Google Docs

I am quite new the using Google Apps Script, but not to JavaScript. I was wondering if there was a way that I could retrieve some text from a Google Docs, and send it in an email, something like this.
This is not the correct syntax, but bear with me.

function createAndSendDocument() {
    var email = "email";
    var subject = "Subject";
    var body = 
        GmailApp.sendEmail(email, subject, body);
}

Is there a way that I could do something like this,

var randnum = random(1,4)
getText(documentname, text from document)

Text on the document would look something like this.

  1. Hello

  2. Test

  3. How are you?

  4. Watermelon!
    Where getting the text from the document is based on randnum, example: randnum = 1 so email body would be "Hello"

Sorry for all the jumping around in the question, but hope you can answer this. Comment if you need any clarification.

Leave a Comment