Skip to main content Skip to footer

Automatically Convert Entered Cell Text to Upper or Lower Case

With the EditEnded event, we can apply changes to entered cell data once the user leaves edit mode in a cell. This is how we can enforce text formatting; for example, we may have a range that must be in all uppercase or lowercase characters. We can apply the JavaScript native toUpperCase or toLowerCase methods in this manner, for example.

See the following sample code:

spread.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, args) {
    if (args.col == 0) {    //targets column A, set your own range as needed
        //UPPERCASE
        args.sheet.setValue(args.row, args.col, args.editingText.toUpperCase())
        //lowercase
        //args.sheet.setValue(args.row, args.col, args.editingText.toLowerCase())
    }
});

Tye Glenz