0

I managed to generate a XML file to import in my GoogleDrive like this

function createXML() {
  var Origine = "Example"

  var xml = '<?xml version="1.0"?>\n';
  xml += '<root>\n';
  xml += '  <element>' + Origine + '</element>\n';
  xml += '</root>\n';
  
  var blob = Utilities.newBlob(xml, 'application/xml', 'my-xml.xml');
  
  
var folder = DriveApp.getFolderById("XXXXXXXXXXXXXXXXXXXXXXXX");
  blob.setName("my-xml.xml");
  folder.createFile(blob);
}

But I would like to download this blob as XML file directly on my computer without passing through Google Drive. What could be the easiest solution ?

I tried different method. But I'm not a great coder...

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • I would consider using Javascript LocalStorage – Cooper Jan 09 '23 at 22:14
  • It's not possible to save a file to local storage using only server side code (.gs). You could use HtmlService or ContentService to return the proper object to the client-side so the browser will handle the download. – Rubén Jan 10 '23 at 00:13
  • I would have used Javascript. – Cooper Jan 10 '23 at 02:25

0 Answers0