0

I want the create a widget where user can select spreadsheet tab. The consent screen asked the user to login/allow to access his drive with offline access (first time prompt only). After login/allow : User's all spreadsheet list an on selection download all the sheets of selected spreadsheet in separate csv files. For this I used drive/sheet api in java-script. But now I only can download the first sheet of selected spreadsheet.

function downloadGDriveFile (file) {
var request1 = gapi.client.drive.files.export({
  'fileId': '137QkATyycYn-qwy9z0OGx70EsbmwFGcxarCxq45vfAo',
  'mimeType': 'text/csv'
  //'mimeType': 'application/vnd.oasis.opendocument.spreadsheet'
})
request1.then(function(response) {
  console.log(response);
  alert(response.body);
        $.ajax({
    type: "POST",
    url: 'http://devhub.escalon.services/scripts/ravin/last/interfacefile.php',
    data: {data : response.body},
    success: function(response) {
    }
});
}, function(err) {
  console.log('Error');
  console.log(err.result.error);
});
}

Is it possible to download all sheets as csv. Or I have to use any other way to accomplish this task. I tried many codes but didn't find any solution. Help me with a solution/code. Or tell any other way to accomplish my task

techie
  • 13
  • 6
  • http://stackoverflow.com/questions/27000699/google-spreadsheet-direct-download-link-for-only-one-sheet-as-excel?rq=1 – pinoyyid Apr 27 '17 at 12:36
  • I has checked all the option given on stack overflow or google forum. I didn't find any parameter where I can pass the gid of sheet. My code is available above. I didn't find any way to pass the url or make an http request needed for the solution. Help – techie Apr 28 '17 at 04:01

0 Answers0