Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:11:47+00:00 2026-06-11T22:11:47+00:00

I am having a problem in to fetch the content of the document. I

  • 0

I am having a problem in to fetch the content of the document. I am able to fetch the document id but couldn’t get the document’s text.
I am using the following code for this:

function getDocuments(user){
  var scope = 'https://docs.google.com/feeds/';
  //oAuth
  user="email-id"
  var fetchArgs = googleOAuth_('docs', scope);
  var url = scope + user+'/private/full?v=3&alt=json';
  var urlFetch = UrlFetchApp.fetch(url, fetchArgs);
  var json=Utilities.jsonParse(urlFetch.getContentText())
  var entry = json.feed.entry;
  var docs = [];
  for(var i in entry){
    var tempDoc = {};
    for(var j in entry[i]){

      tempDoc.id = entry[i].id.$t.split('%3A')[1];
    }
    docs.push(tempDoc);
    //Logger.log(docs[i])
  }


  var url='https://docs.google.com/feeds/download/documents/Export?docID=?'

  var data=UrlFetchApp.fetch(url,fetchArgs).getAs('text/html').getDataAsString()
  MailApp.sendEmail("email","","",{htmlBody:data})
}

//--------------------------------------------------------------------------------------
//Google oAuth
//Used by getDocuments(user)
function googleOAuth_(name,scope) {
  var oAuthConfig = UrlFetchApp.addOAuthService(name);
  oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
  oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
  oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
  oAuthConfig.setConsumerKey("consumerkey");
  oAuthConfig.setConsumerSecret(consumersecret);
  return {oAuthServiceName:name, oAuthUseToken:"always",method:"GET"};
}

It returns html format of document but, couldn’t return the content of document.
Please share me any suggestion asap..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:11:49+00:00Added an answer on June 11, 2026 at 10:11 pm

    if you want the doc to be the html body of a mail you can use this code :

        var id = 'the ID of your document'
        var bodytext = DocumentApp.openById(id).getText();//the text content of your doc (optional)
        var url = 'https://docs.google.com/feeds/';
        var doc = UrlFetchApp.fetch(url+'download/documents/Export?exportFormat=html&format=html&id='+id,
        googleOAuth_('docs',url)).getContentText(); 
    
    
        MailApp.sendEmail(destination email, subject, bodytext, {htmlBody:doc});
    

    and the OAuth function :

    function googleOAuth_(name,scope) {
      var oAuthConfig = UrlFetchApp.addOAuthService(name);
      oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
      oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
      oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
      oAuthConfig.setConsumerKey('anonymous');
      oAuthConfig.setConsumerSecret('anonymous');
      return {oAuthServiceName:name, oAuthUseToken:"always"};
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a strange problem here. Here's the code, I'm using to fetch a
I am having problem to get a numerical value for this expression where I
I am having a funky problem. Here's my code. I run getJSON() to fetch
Having problem with this bit of code qith jQuery. it should pick the values
I'm facing some problem when I fetch page content of particular Id. I'm using
I'm having a problem with __sync_fetch_and_and incorrectly performing. I wrote the following code to
Im having problem in my UIscrollView ,this is what I have done: Whenever a
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
I'm having problem with datagrid view. I have attached an image with the code
I am having problem with drawing multiple lines during repaint. The code is as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.