import certain arrays from csv file to google spreadsheet - NOT the whole range, but ONLY some cells with 4 digits instead of 1, 1, -


i have script csv data import amit's website. me not work 4 digits dimension

function importcsvfromgoogledrive() {    var file = driveapp.getfilesbyname("data.csv").next();   var csvdata = utilities.parsecsv(file.getblob().getdataasstring());   var sheet = spreadsheetapp.getactivesheet();   sheet.getrange(1, 1, csvdata.length, csvdata[0].length).setvalues(csvdata);  } 

what i'm trying import specific range of csv file. far understood if type 1, 1, paste cells spreadsheet (starting row1, column1). way when new data arrives(for example subsidiary) overwrite entire spreadsheet. i'm trying find way import(as described in "sheet.getrange(1,1,1,12) numbers in bracket specify?") cells c2 g8.maybe possible 4 digits dimension i'm not sure how amit's script.

thank help.

problem: import specific range of csv file. cells c2 g8

given:

var csvdata = utilities.parsecsv(file.getblob().getdataasstring()); sheet.getrange(1, 1, csvdata.length, csvdata[0].length).setvalues(csvdata); 

then:

this produce array have existed @ "c2:g8"

var c2g8array=subarray(csvdata,2,3,8,7); 

where:

subarray() defined below:

//ia=inputarray ulrow=upper left row, ulcol=upper left column, lrrow=lower right row, lrcol=lower right column function subarray(ia,ulrow,ulcol,lrrow,lrcol) {   var oa=[];   for(var i=0;i<ia.length;i++)   {     if(i>=ulrow-1 && i<=lrrow-1)     {        oa.push(ia[i].slice(ulcol-1,lrcol));     }   }   return oa; } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -