0

I use this code to generate a XML file on my Google Drive :

var nomFichierXML = "CazaAzul_CSI_"+AccountingPeriod+"_"+DateDuJour
var blob = Utilities.newBlob(xml, 'application/xml', 'CSI.xml');
var folder = DriveApp.getFolderById("FolderID");
blob.setName(nomFichierXML+".xml");
folder.createFile(blob);

I would like to download this file automatically on my local computer just after the "folder.creatFile(blob)" function.

I managed to creat the URL of this filw with this command :

var fileId = file.getId();
var urlCSI = file.getDownloadUrl()

But after that... I'm stuck.

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • Are you looking to trigger a download popup or just create the file directly in some local folder? In the first case you'll probably need to [display the link somehow](https://stackoverflow.com/questions/20281272/initiate-a-download-from-google-apps-script) so the user clicks it. For the second case, Apps Script runs server side and it doesn't have access to your local files so you can't do it. – Daniel Jan 12 '23 at 14:30
  • Hello, a simple trigger would be perfect. I will read the post your sent to me. Thank's ! – Robin Erard Jan 12 '23 at 18:14
  • Saddyl UiApp doesn't exist anymore. – Robin Erard Jan 12 '23 at 18:20
  • The OP's post is deprecated but [this answer](https://stackoverflow.com/a/69548483/12306687) has more recent info. – Daniel Jan 12 '23 at 18:44

0 Answers0