Creating Downloaded Excel file as Spreadsheet

This is a sample GAS script to create an Excel file, which was downloaded from web, as Spreadsheet. By using Drive API, it can be achieved without access token.

Script :

function downloadFile(fileURL, folder) {
  var filename = fileURL.match(".+/(.+?)([\?#;].*)?$")[1];
  var response = UrlFetchApp.fetch(fileURL);
  var rc = response.getResponseCode();
  var blob = response.getBlob();
  var resource = {
    "mimeType": "application/vnd.google-apps.spreadsheet",
    "parents": [{id: folder}],
    "title": filename
  };
  var res = Drive.Files.insert(resource, blob);
  var fileInfo = [rc, res.title, blob.getBytes().length, res.id];
  return fileInfo;
}

Result :

[
    200,
    sample.xlsx,
    10000.0,
    ## file id ##
]