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 6624895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:42:31+00:00 2026-05-25T21:42:31+00:00

I m in the process of creating a custom timesheet using Google Docs and

  • 0

Im in the process of creating a custom timesheet using Google Docs and Google Apps Script. One of the requirements is to save the timsheet as a PDF when the user submits the timesheet. Heres what I currently have:

function createPdf(){

  var ss = SpreadsheetApp.getActiveSpreadsheet();

  var oauthConfig = UrlFetchApp.addOAuthService("google");
  oauthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
  oauthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope=https://spreadsheets.google.com/feeds/");
  oauthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
  oauthConfig.setConsumerKey("anonymous");
  oauthConfig.setConsumerSecret("anonymous");

  var url =  "https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key="
      + ss.getId() +  "&gid=0&portrait=true" +"&exportFormat=pdf";

  var requestData = {
    "oAuthServiceName": "google",
    "oAuthUseToken": "always"
  };

  var result = UrlFetchApp.fetch(url, requestData);
  var content = result.getBlob();
  var file = DocsList.createFile(content);

  return file;

}

When debugging the script, I get the following error:

Unexpected exception upon serializing continuation

Any help would be appreciated.

  • 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-05-25T21:42:32+00:00Added an answer on May 25, 2026 at 9:42 pm

    After some further digging, I found this solution:

    function createPdf(){
    
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var pdf = ss.getAs("application/pdf");
      var file = DocsList.createFile(pdf);
      file.rename("Test");
    
      return file;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of creating an XML Schema and one of my
I'm creating an installer using InnoSetup , and writing some custom handlers in a
In VBP its possible to define user defined actions by creating a custom COM
I am trying to code the process of creating Zend_Form objects using Doctrine2 ClassMetadatas
I'm in the process of creating a custom view for my android application and
I am in the process of creating a custom control in C# for business
I'm in the process of creating a custom stream for an API endpoint in
I'm in the process of creating my own custom ModelBinder that inherits from DefaultModelBinder,
I'm in the process of creating a plugin which creates several custom post types
Suppose that a process is creating a mutex in shared memory and locking it

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.