0
votes

I have some XML-files saved on Google Drive. I want to save their content into a spreadsheet. Google Apps Script should be the tool:

  • DriveApp locates files.

  • XmlService reads XML-files.

  • SpreadsheetApp stores the content.

I don't know how to read the content from a XML-file saved on Drive.

  • DriveApp gives a downloadUrl but GAS doesn't allow downloading files.

  • UrlFetchApp isn't authenticated.

It it impossible or is there a workaround?

1

1 Answers

4
votes

here a little code that may help you:

function xmlRead(){
  var id = "ID_OF_THE_FILE";
  var rawXml = DriveApp.getFileById(id).getBlob().getDataAsString();
  var xml = XmlService.parse(rawXml).;
  // then it's your job to extract what you want from this XML

  var ssid = "ID_OF_THE_SPREADSHEET";
  var ss = SpreadsheetApp.openById(ssid);
  ss.appendRow(["some stuff you extracted"]);
}