有没有一种方法可以按数字/相反方向对这个Google脚本功能进行排序? [英] Is there a way to sort this Google scripts function numerically/opposite direction?

本文介绍了有没有一种方法可以按数字/相反方向对这个Google脚本功能进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我用来将Google表格文档的所有表格名称拉到前页列表中的脚本.这是工作;但是,有没有一种方法可以以相反的方式进行分类呢?我有按日期命名的图纸,其中最早的日期是最远的图纸,而最新的图纸是最靠近正面的图纸.因此,它将首先对最新的日期进行排序,但我希望它首先对最旧的日期进行排序.另外,是否有办法使此功能动态化,以便在添加新工作表时或工作表名称更改时进行更新?

Here is the script that I'm using to pull all the sheet names of a Google Sheet Document into a list on a front sheet. It is working; however, is there a way to sort this the opposite way? I have the sheets named by date with the oldest date as the furthest sheet and the newest sheet the closest to the front. So it is sorting the newest date first but I would like it to sort with the oldest date first. Also, is there a way to make this function dynamic so it updates as new sheets are added or if the sheet names change?

function sheetnames() {
  var out = new Array()
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();


for (var i=0 ; i<sheets.length ; i++) {
  Logger.log(String(sheets[i].getSheetId()));
 // var sheetId = sheets.getSheetId()
  out.push( [ sheets[i].getName() ] ) 
}

return out 
}

推荐答案

对不起,我回答了错误的问题.

Sorry I answered the wrong question.

这篇关于有没有一种方法可以按数字/相反方向对这个Google脚本功能进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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