0

I'm working on a Google Apps Script script that needs to import an XML file with data we'd rather not make available publicly. Usually, an IP restriction would be set up to protect this data and only make it accessible for the tool we use.

I'm guessing Google uses multiple IPs to request the XMLs so does anyone have suggestions on how to protect our data?

Casper
  • 1,435
  • 10
  • 22
  • 1
    Yes you can use [XML Service](https://developers.google.com/apps-script/reference/xml-service/) for this case. But where will you save the imported XML file? – abielita Mar 29 '17 at 07:53
  • The imported XML data will be used for campaign management. I will not save an XML file or whatsoever. I just want to read the data and act based on the data. – Casper Mar 29 '17 at 11:21
  • If you just want to read the data, then you can just use the [XML Service](https://developers.google.com/apps-script/reference/xml-service/) as stated above. Here's a [sample code](http://stackoverflow.com/a/40666749/5832311). The function takes a string argument, being your XML, and returns a two-dimensional array. – abielita Mar 30 '17 at 02:20
  • @abielita I do not have problems with reading an XML, but I am looking for a solution in which only Google XMLService is able to read my XML file and not other people / software. – Casper Mar 30 '17 at 06:55

1 Answers1

0

Not the most secure method, but perhaps it could work for you? I just recently worked on a project I had to set a spreadsheet to public to run a procedure and as soon as it finishes it sets it back to private. Perhaps you could do something like that?

    var ss = SpreadsheetApp.getActive();
    var sheet = DriveApp.getFileById(ss.getId());

    // sets sharing to public -
    sheet.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
    
    // returns the file back to Private access
    sheet.setSharing(DriveApp.Access.PRIVATE, DriveApp.Permission.EDIT);
OblongMedulla
  • 1,471
  • 9
  • 21