google-apps-script Changing column format

纵饮孤独 提交于 2020-06-27 10:02:05

问题


need to format columns c, e and a few others to show the date using the format below:

4 July 2014

Can't work out how to do it ... new to google script!


回答1:


To do this using Apps script, you can use the setNumberFormat(numberFormat), which lists that date formats follow the SimpleDateFormat specification.

Sample code that will do this:

function formatDate(){
  var ss = SpreadsheetApp.getActive();
  var sheet = ss.getActiveSheet();
  sheet.getRange("A2").setNumberFormat('dd MMM yyyy');
};


来源:https://stackoverflow.com/questions/27589578/google-apps-script-changing-column-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!