Convert Google Spreadsheet to Excel XLS with Script -


let me first realize question has been asked before, sincere apologies bringing again. however, have tried of suggestion , can't work out. trying write script take google spreadsheet, convert excel xls/xlsx format , email converted file attachment. here's coding tries create converted file.

function googleoauth_(name,scope) {   var oauthconfig = urlfetchapp.addoauthservice(name);   oauthconfig.setrequesttokenurl("https://www.google.com/accounts/oauthgetrequesttoken?scope="+scope);   oauthconfig.setauthorizationurl("https://www.google.com/accounts/oauthauthorizetoken");   oauthconfig.setaccesstokenurl("https://www.google.com/accounts/oauthgetaccesstoken");   oauthconfig.setconsumerkey('anonymous');   oauthconfig.setconsumersecret('anonymous');   return {oauthservicename:name, oauthusetoken:"always"}; }  function test(){ var id = docslist.getfilebyid('file_id_here'); var url = 'https://docs.google.com/feeds/'; var doc = urlfetchapp.fetch(url+'download/spreadsheets/export?key='+id+'&exportformat=xls', googleoauth_('docs',url)).getblob() docslist.createfile(doc).rename('newfile.xls') }  function autorise(){   // function call authorize googleoauth   var id = spreadsheetapp.getactivespreadsheet().getid()   var url = 'docs.google.com/feeds/';   var doc = urlfetchapp.fetch(url+'download/documents/export?exportformat=html&format=html&id='+id, googleoauth_('docs',url)).getcontenttext(); } 

i have read authorizing procedure primary culprit. have granted authorization , appears run line below , errors.

var doc = urlfetchapp.fetch(url+'download/spreadsheets/export?key='+id+'&exportformat=xls', googleoauth_('docs',url)).getblob() 

the error message states following:

request failed returned code 404. truncated server response:  <!doctype html><html lang="en" ><head><meta name="description" content="web word processing, presentations , spreadsheets"><link rel="shortcut ic...  (use mutehttpexceptions option examine full response) (line 50, file "code") 

if has ideas, appreciate it.

the code show (without referencing source) old version of spreadsheets.

it not work new version.

read documentation on drive advanced service, find explanation want.

this post should : oauth error when exporting sheet xls in google apps script


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -