Monday, May 11, 2020

Tip 4 Other

  • Increase the density of x-ticks (python)
    • test = sns.distplot(df.BattlePower_diff, 100, kde=False)
      plt.xticks(rotation=90)
      test.xaxis.set_major_locator(plt.MaxNLocator(200))
  • Automatic timestamp when a cell on the same row gets updated (google sheet)

    function onEdit(e) {
      var ss = SpreadsheetApp.getActiveSheet();
      var r = ss.getActiveCell();
      //1.Change 'Sheet1' to be matching your sheet name
      if (r.getColumn() > 1 && ss.getName()=='Sheet1') { // 2. If Edit is done in any column after Column (A)  And sheet name is Sheet1 then:
    var celladdress ='A'+ r.getRowIndex() 
        ss.getRange(celladdress).setValue(new Date()).setNumberFormat("yyyy-MM-dd hh:mm:ss");
      }
    };


  • Automatic sorting when a cell gets updatd (google sheet)

    function onEdit(event){
      var sheet = event.source.getActiveSheet();
      var editedCell = sheet.getActiveCell();
    
      var columnToSortBy = 4;
      var tableRange = "B3:E9";
    
      if(editedCell.getColumn() == columnToSortBy){   
        var range = sheet.getRange(tableRange);
        range.sort( { column : columnToSortBy } );
      }
    }


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.