Questions tagged [spreadsheet-protection]

Use for questions about programmatically interacting with inbuilt protections in any spreadsheet. Use with appropriate spreadsheet software tag like [excel], [google-sheets], [libreoffice-calc], [openoffice-calc] and the language tag like [python], [google-apps-script]. Do NOT use for non-programmatic usage.

Protection is a inbuilt feature in most spreadsheet software, where some parts of the spreadsheet like sheet or range can be protected from unwanted edits from users.

Feature Reference:

54 questions
2
votes
2 answers

Excel macro data refresh and protection

In an Excel macro I need to unprotect a sheet, refresh the data and then protect the sheet. The following works: Dim rs As Worksheet For Each rs In Worksheets rs.Unprotect Password:="SomePassword" Next rs ActiveWorkbook.RefreshAll This does…
Rich
  • 21
  • 3
2
votes
1 answer

Select specific locked cells, leaving other cells 'unselectable'

In Excel VBA, is there a way to select specific locked cells, while leaving other cells 'unselectable'? I have an excel sheet, which is protected. I would like to give the user the ability to select specific locked cells within a sheet while at the…
1
vote
1 answer

Check if a Google Sheets cell has protection with Google Apps Script

How to check if a cell in Google Sheets has protection with Google Apps Script? Specifically, range protection, not sheet protection.
1
vote
1 answer

How to ignore already protected sheets with script?

Every day create 2-3 sheets but a minimum of one these ranges are protecting ["B3:U27", "W3:AP27", "B29:U33", "W29:AP33"] I reduced the 42 ranges to these 4 ranges to make it faster but still in 1 minute it can protect about 8 files the problem is…
1
vote
1 answer

Replace user in a protected range by script (Google Sheet)

here my specific case: I have some range protected in google sheets I need to replace some specific Editor if is editor of those range (var Editor2Replace and Editor2Add are emails) Logically I tried to, for each sheet: Cycle (FOR) of all the…
1
vote
1 answer

How can I get this to protect a sheet on scripting basis (Google Apps Script)?

I got this piece of code running with no error; The resulting spreadsheet does show a locker next to the sheet name; Protected Sheets and Ranges show only specific range is unprotected, but the other user opening the file can edit protected ranges: …
onit
  • 2,275
  • 11
  • 25
1
vote
2 answers

Running Script through image in Locked gSheet

Trying to run a script triggered by an image inserted in a protected sheet. The sheet is shared by several users. oOly the author is enabled to edit; all other users are locked out via setDomainEdit(false), except for range ('a1:b3'). when a user…
1
vote
1 answer

How to set protection for everyone with google script for spreadsheet?

I'm creating a script that copy-paste a sheet. The copied sheet is protected for everyone (except me the owner). When the user click on the button, the script runs and copy-paste my main sheet, the script set a protection to all users, except…
Simon
  • 13
  • 4
1
vote
2 answers

How to format UnprotectedRanges?

I would like to put a red border around each cell in a spreadsheet which does not have any protection assigned to the cell or range of cells. I know how to set a border but how do I access the formatting for the unprotectedranges? function wtf()…
1
vote
1 answer

Google scripts sheet creation (protection issue)

Ok, stackoverflow. I'll jump right into my question. I have a main workbook with a lot of information supplying (via. a query/importrange) the correct information to several individual workbooks. I update the main workbook every week and create new…
1
vote
1 answer

Google Apps Script run time very slow when protecting multiple ranges

Currently, I have a Google Script where I have to protect multiple ranges for multiple people across multiple sheets in one worksheet. Here is the code I have right now: function setPermissions () { for (var number = 1; number < 30; number++) { …
1
vote
1 answer

Protected Excel workbook broken after pasting data from a "newer" workbook

Given an excel workbook with an unlocked cell in a protected worksheet. If I copy a cell from another workbook which was opened after target workbook, and paste it to the unlocked cell, it becomes locked and I can't do anything with it except undo…
astef
  • 8,575
  • 4
  • 56
  • 95
1
vote
3 answers

Processing apply protection on multiple ranges all together

Recently ability to manipulate protection for a range programatically has been added. But is there a way to add multiple ranges all together when they have same protection to apply protection instead of processing each range one at a time? The…
1
vote
1 answer

How do I set locked cell protection options in Excel with C# and Interop?

Here's the background info. I have an app that writes to an excel 2007 .xlsm file and I am using C# and the Excel 12.0 interop object libraries to do it, along with Visual Studio 2010. I am able to change the cell values and formulas, set the font…
Mike Webb
  • 8,855
  • 18
  • 78
  • 111
1
vote
2 answers

How to protect from editing only rows that are odd numbered?

In Google Sheets how do I protect the rows in Column A which are odd from any kind of edits? I would like to use this function =ISODD(ROW(A1)) Protected sheets and ranges gives you this by default Sheet1!A1 I can do this Sheet1!A1:A1000 which…
SSpoke
  • 5,656
  • 10
  • 72
  • 124