Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited tags
Link
Bumped by Community user
Bumped by Community user
reformatted
Source Link
Blindspots
  • 7.5k
  • 5
  • 20
  • 38

I am trying to remove the protection from a specific cell after its content is deleted and then change it'sits background to white.

Thank you in advance.

Here is the script:

    function onEdit(e) {
      var spreadsheet = SpreadsheetApp.getActive();
      const range = e.range;
      var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
      var a1o = cell.getA1Notation();
      a1 = "'" +a1o+ "'"
      var val = cell.getValue();
    
      if (val == "") {
        var allProtections = 
        spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE);
        var matchingProtections = allProtections.filter(function(existingProtection) {
          return existingProtection.getRange().getA1Notation() == +a1;
        });
        var protection = matchingProtections[0];
        protection.remove();
        ss.getActiveRangeList().setBackground('White');
      }
    }

I am trying to remove the protection from a specific cell after its content is deleted and then change it's background to white.

Thank you in advance.

Here is the script:

    function onEdit(e) {
      var spreadsheet = SpreadsheetApp.getActive();
      const range = e.range;
      var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
      var a1o = cell.getA1Notation();
      a1 = "'" +a1o+ "'"
      var val = cell.getValue();
    
      if (val == "") {
        var allProtections = 
        spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE);
        var matchingProtections = allProtections.filter(function(existingProtection) {
          return existingProtection.getRange().getA1Notation() == +a1;
        });
        var protection = matchingProtections[0];
        protection.remove();
        ss.getActiveRangeList().setBackground('White');
      }
    }

I am trying to remove the protection from a specific cell after its content is deleted and then change its background to white.

Here is the script:

    function onEdit(e) {
      var spreadsheet = SpreadsheetApp.getActive();
      const range = e.range;
      var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
      var a1o = cell.getA1Notation();
      a1 = "'" +a1o+ "'"
      var val = cell.getValue();
    
      if (val == "") {
        var allProtections = 
        spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE);
        var matchingProtections = allProtections.filter(function(existingProtection) {
          return existingProtection.getRange().getA1Notation() == +a1;
        });
        var protection = matchingProtections[0];
        protection.remove();
        ss.getActiveRangeList().setBackground('White');
      }
    }

I am trying to remove the protection from a specific cell after it'sits content is deleted and then change it's background to white. Thank

Thank you in advance. Here

Here is the script:

function onEdit(e) { var spreadsheet = SpreadsheetApp.getActive(); const range = e.range; var cell = SpreadsheetApp.getActiveSheet().getActiveCell(); var a1o = cell.getA1Notation(); a1 = "'" +a1o+ "'" var val = cell.getValue();

if (val == "") { var allProtections = spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE); var matchingProtections = allProtections.filter(function(existingProtection) { return existingProtection.getRange().getA1Notation() == +a1; }); var protection = matchingProtections[0]; protection.remove(); ss.getActiveRangeList().setBackground('White'); } }

    function onEdit(e) {
      var spreadsheet = SpreadsheetApp.getActive();
      const range = e.range;
      var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
      var a1o = cell.getA1Notation();
      a1 = "'" +a1o+ "'"
      var val = cell.getValue();
    
      if (val == "") {
        var allProtections = 
        spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE);
        var matchingProtections = allProtections.filter(function(existingProtection) {
          return existingProtection.getRange().getA1Notation() == +a1;
        });
        var protection = matchingProtections[0];
        protection.remove();
        ss.getActiveRangeList().setBackground('White');
      }
    }

I am trying to remove the protection from a specific cell after it's content is deleted and then change it's background to white. Thank you in advance. Here is the script:

function onEdit(e) { var spreadsheet = SpreadsheetApp.getActive(); const range = e.range; var cell = SpreadsheetApp.getActiveSheet().getActiveCell(); var a1o = cell.getA1Notation(); a1 = "'" +a1o+ "'" var val = cell.getValue();

if (val == "") { var allProtections = spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE); var matchingProtections = allProtections.filter(function(existingProtection) { return existingProtection.getRange().getA1Notation() == +a1; }); var protection = matchingProtections[0]; protection.remove(); ss.getActiveRangeList().setBackground('White'); } }

I am trying to remove the protection from a specific cell after its content is deleted and then change it's background to white.

Thank you in advance.

Here is the script:

    function onEdit(e) {
      var spreadsheet = SpreadsheetApp.getActive();
      const range = e.range;
      var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
      var a1o = cell.getA1Notation();
      a1 = "'" +a1o+ "'"
      var val = cell.getValue();
    
      if (val == "") {
        var allProtections = 
        spreadsheet.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.RANGE);
        var matchingProtections = allProtections.filter(function(existingProtection) {
          return existingProtection.getRange().getA1Notation() == +a1;
        });
        var protection = matchingProtections[0];
        protection.remove();
        ss.getActiveRangeList().setBackground('White');
      }
    }
Source Link
Loading