“MMMM yy”-date in google spreadsheet

前端 未结 5 747
轮回少年
轮回少年 2021-02-01 16:42

I have a google spreadsheet in which I want a date with only the name of the month and the year, like September 2011, and I also want the month and year to be easil

5条回答
  •  臣服心动
    2021-02-01 17:05

    You can set a custom format to a cell using Google Apps Script.
    Open the script editor (menu Tools > Script editor), paste this, save and Run > onOpen.

    function onOpen() {
      SpreadsheetApp.getActive().addMenu(
        'Format', [{name:'Custom', functionName:'customFormat'}]);
    }
    
    function customFormat() {
      var format = Browser.inputBox('Write the format to be applied on the seleted cells');
      if( format !== 'cancel' )
        SpreadsheetApp.getActiveRange().setNumberFormat(format);
    }
    

    On your spreadsheet a new menu should appear in the end where you can pick the Custom entry to enter your custom format for the selected cells.

提交回复
热议问题