Листинг получения файла
/* Google Driva APIv2
* Getting CSV Link */
gapi.client.request({
'path': '/drive/v2/files/' + 'LINK',
'method': 'GET',
callback: function (theResponseJS, theResponseTXT) {
var theResponseJSON = JSON.parse(theResponseTXT);
var bodyJSON = JSON.parse(theResponseJSON.gapiRequest.data.body);
var accessToken = gapi.auth.getToken().access_token;
var xhr = new XMLHttpRequest();
var link = bodyJSON.embedLink.replace(/\/htmlembed$/, '');
link += "/export?format=csv"; // for large file use "/gviz/tq?tqx=out:csv"
xhr.open('GET', link, true);
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
xhr.onload = function () {
console.log(xhr.responseText);
};
xhr.onerror = function (error) {
console.error(error);
};
xhr.send();
}
});