Is there a way to save html text to a file in google drive using apps script?

后端 未结 1 1565
北荒
北荒 2021-01-06 09:45

Is there a way to save html text to a file in google drive using apps script? My app sends back an html string, which I want to save as an .html file into drive, as if I\'d

1条回答
  •  梦毁少年i
    2021-01-06 10:14

    var url = 'YOUR PAGE;
    var p = SitesApp.getPageByUrl(url);
    var html = p.getHtmlContent();
    var blob = DriveApp.createFile('dummy',html, 'text/html').getBlob();
    var resource = {
      title: 'YOUR FILE NAME',
      convert: true,
      mimeType: 'application/vnd.google-apps.document' 
    };
    Drive.Files.insert(resource,blob);
    

    0 讨论(0)
提交回复
热议问题