Convert all xls files available in a folder into "Google Doc Spreadsheets"? -


the basic way turn conversion on when uploading files google drive.

another way select xls file in folder , convert 1 one hand.

but if 1 has many xls files uploaded in folder, may faster convert them google apps script re-uploading again files.

in case:

  • once converted, need delete xls files
  • all xls files below limits : "uploaded spreadsheet files converted google spreadsheets format can’t larger 100 mb, , need under 400,000 cells , 256 columns per sheet." https://support.google.com/drive/answer/37603?hl=en

thanks in advance;)

you should use advanced drive service, file update

this service must enabled before use doc pretty clear.


edit (following comments)

(sorry long delay, forgot post)

this code convert every xls files in drive google spreadsheet format (as long names have .xls extension)

you must authorize drive extended ressource + api console (follow instructions ressource/advanced services menu, see illustration below)

function importxls(){   var files = driveapp.searchfiles('title contains ".xls"');// can use folder starting point , files in folder... use driveapp method here.   while(files.hasnext()){     var xfile = files.next();     var name = xfile.getname();     if (name.indexof('.xls')>-1){ // check not necessaey here because files search left in case files differently...       var id = xfile.getid();       var xblob = xfile.getblob();       var newfile = { title : name+'_converted',                      key : id                     }       file = drive.files.insert(newfile, xblob, {         convert: true       });     }   } } 

enter image description here


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -