How to access or call “Send this form to others”?

后端 未结 2 571
别那么骄傲
别那么骄傲 2020-12-09 23:44

I have a form attached to a Google Apps spreadsheet. It\'s a form to let my coworkers submit agenda items to our weekly review meeting. I\'m writing a script to automaticall

相关标签:
2条回答
  • 2020-12-10 00:10

    I have the exact same requirement as you do, but unfortunately there doesn't seem to be an API call that does this.

    What I think might work (though I have yet to actually try this) is to use the Spreadsheet.getFormUrl method to get the form URL, then use UrlFetchAp.fetch to obtain the HTML for the spreadsheet form, and then use that HTML as the e-mail body.

    Like I said, I don't know if this will work (though on paper it should!), but I'd be very interested to know if it did!

    0 讨论(0)
  • 2020-12-10 00:29

    Joris, you're right. You can use the method fetch() to send the form's html to the user's mailbox:

    var form = FormApp.create('New Form');
    ....
    var url = form.getPublishedUrl();
    var response = UrlFetchApp.fetch(url);
    var htmlBody = HtmlService.createHtmlOutput(response).getContent();
        MailApp.sendEmail({
        to: email,
        subject: subject,
        htmlBody: htmlBody,
      });
    ...
    
    0 讨论(0)
提交回复
热议问题