google-apps-script更改列格式 [英] google-apps-script Changing column format

查看:73
本文介绍了google-apps-script更改列格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要使用以下格式设置c,e栏和其他几列的日期,以显示日期:

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

2014年7月4日

无法解决该问题... Google脚本的新功能!

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

推荐答案

要使用Apps脚本执行此操作,可以使用

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');
};

这篇关于google-apps-script更改列格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆