Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:29:25+00:00 2026-06-07T16:29:25+00:00

I’ve got a master sheet that I need to view and filter data from.

  • 0

I’ve got a master sheet that I need to view and filter data from. The data is brought into the sheet using the =Sheet2!B7 syntax.

The problem is that I keep accidentally editing the data in the master sheet which does not update the original copy.

I would like a script that alerts me if I’m in the master sheet and stops me from editing the cells. I still want to be able to filter the data so simply locking the sheet would work.

I’ve been trying to modify this script (posted by Yuzhy) but so far I haven’t been able to get it to work.

(I’m not sure whether this is the right place for this question, it was either this or stackexchange / superuser, if it’s wrong please advise.)

function onEdit(event){
 var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = SpreadsheetApp.getActiveSheet();
  var CellRow = SpreadsheetApp.getActiveRange().getRow();
  var CellColumn = SpreadsheetApp.getActiveRange().getColumn();

  if (CellColumn == 2){
    sheet.getRange(CellRow, CellColumn).setFormula("=A"+CellRow+"+1");
    Browser.msgBox("DON'T MESS WITH THE FORMULAS!");
  }
}

Any help much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:29:26+00:00Added an answer on June 7, 2026 at 4:29 pm

    From reading your code it seems that you’re trying to do a different thing from what you’ve explained. I see that you trying to “repair” the formulas. But why if (CellColumn == 2 )? You want to protect only column B, not the whole “master” sheet?

    Can you share a sample spreadsheet of what your sheet structure looks like?

    Anyway, I’ll suppose that you want to warn when you overwrite anything on your “master” sheet, auto-repairing the formula is a little more complicated (depending on your scenario), and after reading the popup it’s easy to just hit undo and recover it. But you really mean to auto-repair the formulas, I’ll enhance my code after you share a sample of your spreadsheet, since it’s a slightly complicated and depends highly on your structure.

    function onEdit() {
      var s = SpreadsheetApp.getActiveSheet();
      if( s.getName() == "Master" )
        Browser.msgBox("DON'T MESS WITH THE FORMULAS!");
    }
    

    If you’re doing simple reference formulas on other sheets it’s somewhat easier and probably a good solution for you to use an ArrayFormula, that will auto-replace back the value when you change any cell, except for the first cell, but then a manual undo will be so rare and obvious that it will not be an issue, I think. I did an example of array formula on the spreadsheet you linked, please take a look. On A1 I wrote:

    =ArrayFormula(Sheet1!A1:F20)
    

    Now, if you go and accidentally writes something on B2 for example, it value will automatically come back. Try and see if that’s a good solution for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I need a function that will clean a strings' special characters. I do NOT
I have a view passing on information from a database: def serve_article(request, id): served_article
I have thousands of HTML files to process using Groovy/Java and I need to
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.