google action script (Spreadsheet) clear(options) method of Range class not working as expected -


pulling data spreadsheet display via google visualization date-time objects raising error:"the script completed returned value not supported return type" generated.

i found after manual conversion of date-time "plain text" format, worked fine.

the range class has clear method should able remove formatting instead clearing contents cells.

clear({formatonly:true}) 

snippet:

  var sheetid = '1k1p0snweftgvbih4vxbflkayehdrrepmbosyqnm_oxc_we';    var sheet = spreadsheetapp.openbyid(sheetid).getsheets()[3];    //the timestamp object causes error when imported in g.a.s. next 4 lines of code removes formatting.    var range = sheet.getrange("a1:a999");    range.clear({formatonly:true}); // remove formatting column   range = sheet.getrange("e1:e999");   range.clear({formatonly:true}); // remove formatting column e    var data = sheet.getdatarange().getvalues(); 

can please clarify , assist solution?

.clearformat() or .clear({formatonly:true}) clears text formatting cell or cells in range, not reset number formatting rules.

var range = sheet.getrange("a1:a"); range.clearformat(); 

if want set plain text format,

var range = sheet.getrange("a1:a"); range.setnumberformat('@string@'); 

you can further refer range class documentation.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -