It seems that with new version of Google spreadsheet it is no longer possible to download entire Google Spreadsheet using JS. So far I have been using this method (which still works fine for files which were created earlier):
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://docs.google.com/feeds/download/spreadsheets/Export?key=' + id + '&exportFormat=xlsx');
xhr.responseType = 'arraybuffer';
xhr.setRequestHeader('Authorization', 'Bearer ' + gapi.auth.getToken().access_token);
xhr.onload = function() {
...
};
xhr.send();
I have found the new download url:
https://docs.google.com/spreadsheets/d/_ID_/export?format=xlsx&id=_ID_
But unfortunately there is no Access-Control-Allow-Origin
header so the link cannot be accessed using JS. Is there any other possibility I can download the file?
Google Drive API displays export url as:
https://docs.google.com/spreadsheets/export?id=_ID_&exportFormat=xlsx
But there is also no Access-Control-Allow-Origin
header.
Is there any other possibility to download this file using only JS?