How do I copy protection rules from one Workbook to another in Google Sheets

I am an educator and since the beginning of the year we moved all our Mark Books to Google Sheets. Between the classes and subjects we have about 200 active workbooks with some complicated IF statements and VLOOKUPS. I protected those cells but made a slight error which I duplicated to ALL the sheets in ALL the Workbooks. Is there a way for me to use a Script just to copy the protection rules from one Workbook to another? They all have the same sheet names.

Thank you in advance!

macos – Is it possible to get back one earlier “copy” to paste it back?

I typed for 200 words to send to a customer support of a company, and then I copied the content just to keep a copy in my Gmail or Google Docs.

However, before I pasted, I made a phone call using Google voice and pasted the phone number to Google Voice call to dial the number.

So the 200 words content is gone. Is there a way to get it back? The 200 words is such a small size (probably less than 2kbyte), and this MacBook is used only by me, so I don’t worry about privacy of being able to show earlier copy and paste contents. Is there a way to get that earlier copy back?

xml – xslt copy element value if not null to a new element that may not exist

I have an xml below.


I want to copy the value of time2 to time 1 if the time2 value is not empty.
Time2 and Time 1 are both optional and one or both could not be present.
If Time 2 is present and has a value I want to override time1 value or create time1 with that element.

Output from above:


Example 2


Example 2 Output


Example 3


Example 2 Output


I tried this xslt transformation but it didnt work.

<xsl:template match="*(local-name()='time2')">
    <xsl:if test="not(*(.=''))">
            <xsl:value-of select="time2"/>
            <xsl:value-of select="time2"/>


Thank you in advance.

ipad – Copy files from iOS to Arduino using dd command?

I’m having an Arduino based MCU which is capable of running compiled .bin files by just copying them onto the device (connected via USB) using the file explorer. After the file was copied (e.g. with drag and drop) the MCU detects the new .bin file and restarts. That’s working flawlessly on Windows and Linux.

On macOS however, drag and drop is not working. After copying the file using Finder, the MCU does not detect changes and doesn’t restart. Here, I either have to use muCommander or the dd command.

I just wanted to try that on iOS by connecting the MCU to the USB-C / Lightning port of different iPads. The MCU is detected by the Files App, but copying a compiled .bin file to the MCU with the Files app results in the same behaviour as on macOS. I guess both platforms are using similar copying methods.

Is there any way of copying files on iOS using the dd command? Is there any file browser like muCommander to copy files on iOS?

performance – Copy a block of data into existing cells, adding a new line

Wondering about efficiency here – I have a bit of code that does what I want; but it is terribly slow. I structured the code in a way that made sense to me logically, but I’m wondering if someone else could take a look at the code and find a shortcut or two that might make it faster. I’m guessing that I am referencing the Worksheet too often in one of the loops, but haven’t been able to find a good way to restructure to improve performance.

Option Explicit

Sub addAlternateRevCodeLogic()
Dim WS As Worksheet
Dim rng As Range
Dim lastColumn As Long
Dim row As Long
Dim i As Long

Dim ReferenceStyle As XlReferenceStyle

'Arrays of the different Alt Rev Code fields on an EAP
Dim AltID() As String
Dim EffFrom() As String
Dim EffTo() As String
Dim ProvType() As String
Dim BCC() As String
Dim DEP() As String
Dim EAF() As String
Dim Class() As String
Dim RevCode() As String

'Alt Rev Code data from the matching rows
Dim rowAltID As String
Dim rowEffFrom As String
Dim rowEffTo As String
Dim rowProvType As String
Dim rowBCC As String
Dim rowDEP As String
Dim rowEAF As String
Dim rowClass As String
Dim rowRevCode As String

'New and old cost centers
Dim newBCC() As String
Dim oldBCC As String
Dim CostCenter As Variant
Dim userInput As String

'Columns for Rev Code Ranges
Dim AltIDcol As Long 'I EAP 2431
Dim EffFromcol As Long 'I EAP 2434
Dim EffTocol As Long 'I EAP 2435
Dim ProvTypecol As Long 'I EAP 2439
Dim BCCcol As Long 'I EAP 2438
Dim DEPcol As Long 'I EAP 2437
Dim EAFcol As Long 'I EAP 2436
Dim Classcol As Long 'I EAP 2432
Dim RevCodecol As Long 'I EAP 2433

Application.ScreenUpdating = False
ReferenceStyle = Application.ReferenceStyle
If ReferenceStyle = xlR1C1 Then Application.ReferenceStyle = xlA1 'There are certain assumptions in the ranges that don't play nicely with R1C1

'Data is Chr(10) delimited
'Define the range of the EAP Export
Set WS = Worksheets("export")
lastColumn = eap.Cells.Find("*", After:=eap.Cells(1), LookIn:=xlValues, LookAt:=xlWhole, SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
Set rng = WS.Range("A1", WS.Columns(1).Find(what:="#LAST_ROW", LookIn:=xlComments, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Offset(0, lastColumn))

'Define all of the column IDs
AltIDcol = FindCol(2431, eap, True, 1, 1, 1, lastColumn)
EffFromcol = FindCol(2434, eap, True, 1, 1, 1, lastColumn)
EffTocol = FindCol(2435, eap, True, 1, 1, 1, lastColumn)
ProvTypecol = FindCol(2439, eap, True, 1, 1, 1, lastColumn)
BCCcol = FindCol(2438, eap, True, 1, 1, 1, lastColumn)
DEPcol = FindCol(2437, eap, True, 1, 1, 1, lastColumn)
EAFcol = FindCol(2436, eap, True, 1, 1, 1, lastColumn)
Classcol = FindCol(2432, eap, True, 1, 1, 1, lastColumn)
RevCodecol = FindCol(2433, eap, True, 1, 1, 1, lastColumn)

oldBCC = InputBox("What cost center do you want to copy?" & vbNewLine & "Select only one, and don't make typos")
If oldBCC = "" Then MsgBox "Must choose a cost center!", vbOKOnly + vbCritical: Exit Sub

    userInput = InputBox("What are the new cost centers that need added?" & vbNewLine & "You can enter multiple, just keep adding them and then leave the box blank after the last one" & vbNewLine & "Don't make typos", "New Cost Centers")
    Select Case True
        Case CostCenter = "" And userInput <> "" 'Handle the 1st cost center
            CostCenter = userInput
        Case CostCenter <> "" And userInput <> "" 'Handle each new input
            CostCenter = CostCenter & "," & userInput
        Case CostCenter = "" And userInput = "" 'Handle no input
            MsgBox "Must choose at least one new cost center!", vbOKOnly + vbCritical: Exit Sub
    End Select
Loop While userInput <> ""

'oldBCC = "10005320" 'Test Emergency Cost Center
'oldBCC = "10004320" 'Test Pediatrics Cost Center
'CostCenter = "70005320" 'Test New Emergency Cost Center
'CostCenter = "70004110,70004130,70004140,70004200,70004420,70004510,70004400,70004430,70004500" 'Test New Pediatrics Cost Centers
newBCC() = Split(CostCenter, ",")

With rng
    For row = LBound(.Value2) To UBound(.Value2) 'Loop through each row from the export
    If Not IsEmpty(.Value2(row, RevCodecol)) Then 'Find any row that contains an alternate revenue code
        If InStr(1, .Value2(row, BCCcol), oldBCC) Then 'Check if the TRH Emergency Cost Center is using one of the alternate revenue codes
            'Build an array for each Alt Rev Code data item
            RevCode() = Split(.Value2(row, RevCodecol), Chr(10))
            AltID() = Split(.Value2(row, AltIDcol), Chr(10))
            EffFrom() = Split(.Value2(row, EffFromcol), Chr(10))
            EffTo() = Split(.Value2(row, EffTocol), Chr(10))
            ProvType() = Split(.Value2(row, ProvTypecol), Chr(10))
            BCC() = Split(.Value2(row, BCCcol), Chr(10))
            DEP() = Split(.Value2(row, DEPcol), Chr(10))
            EAF() = Split(.Value2(row, EAFcol), Chr(10))
            Class() = Split(.Value2(row, Classcol), Chr(10))
            For i = LBound(RevCode()) To UBound(RevCode())
                If InStr(1, BCC(i), oldBCC) Then 'Set row data for a line with the cost center to copy
                    rowAltID = AltID(i)
                    rowEffFrom = EffFrom(i)
                    rowEffTo = EffTo(i)
                    rowProvType = ProvType(i)
                    rowBCC = BCC(i)
                    rowDEP = DEP(i)
                    rowEAF = EAF(i)
                    rowClass = Class(i)
                    rowRevCode = RevCode(i)
                    'Copy the existing value and add the new line(s)
                    For Each CostCenter In newBCC 'Copy existing lines and add a new entry for each new cost center
                        .Cells(row, AltIDcol).Value = .Value2(row, AltIDcol) & Chr(10) & rowAltID ' & Chr(10)
                        .Cells(row, EffFromcol).Value = .Value2(row, EffFromcol) & Chr(10) & rowEffFrom ' & Chr(10)
                        .Cells(row, EffTocol).Value = .Value2(row, EffTocol) & Chr(10) & rowEffTo ' & Chr(10)
                        .Cells(row, ProvTypecol).Value = .Value2(row, ProvTypecol) & Chr(10) & rowProvType ' & Chr(10)
                        .Cells(row, BCCcol).Value = .Value2(row, BCCcol) & Chr(10) & CostCenter ' & Chr(10)
                        .Cells(row, DEPcol).Value = .Value2(row, DEPcol) & Chr(10) & rowDEP ' & Chr(10)
                        .Cells(row, EAFcol).Value = .Value2(row, EAFcol) & Chr(10) & rowEAF ' & Chr(10)
                        .Cells(row, Classcol).Value = .Value2(row, Classcol) & Chr(10) & rowClass ' & Chr(10)
                        .Cells(row, RevCodecol).Value = .Value2(row, RevCodecol) & Chr(10) & rowRevCode ' & Chr(10)
                    Next CostCenter
                End If
            Next i
        End If
    End If
    Next row
End With
If ReferenceStyle = xlR1C1 Then Application.ReferenceStyle = xlR1C1
Application.ScreenUpdating = True
MsgBox "Rev Codes updated. Test the import.", vbInformation + vbOKOnly
End Sub

java – Copy to clipboard – Android studio (getString – settextView)

I’m trying to add a “copy” button to a settextview.

Here is my full code:

public class activity_tasks extends AppCompatActivity {
    private Button button_refresh;
    TextView textView;
    TextView textView4;
    private AdView mAdView;

    @RequiresApi(api = Build.VERSION_CODES.M)
    protected void onCreate(Bundle savedInstanceState) {

        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            public void onInitializationComplete(InitializationStatus initializationStatus) {
        mAdView = findViewById(;
        AdRequest adRequest = new AdRequest.Builder().build();

        button_refresh = findViewById(;

        button_refresh.setOnClickListener(v -> {

            overridePendingTransition(0, 0);

        Button button = findViewById(;
        Button button_copy = findViewById(;
        button.setOnClickListener(v -> showInfo());
        textView = findViewById(;


    private void downloadJSON() {

        class DownloadJSON extends AsyncTask<Void, Void, String> {

            protected void onPreExecute() {

            protected void onPostExecute(String s) {

                try {
                } catch (JSONException e) {

            protected String doInBackground(Void... voids) {
                try {
                    URL url = new URL("");
                    HttpURLConnection con = (HttpURLConnection) url.openConnection();
                    StringBuilder sb = new StringBuilder();
                    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
                    String json;
                    while ((json = bufferedReader.readLine()) != null) {
                    return sb.toString().trim();
                } catch (Exception e) {
                    return null;
        DownloadJSON getJSON = new DownloadJSON();

    private void settextView(String json) throws JSONException {
        JSONArray jsonArray = new JSONArray(json);
        String() tasks = new String(jsonArray.length());
        for (int i = 0; i < jsonArray.length(); i++) {
            JSONObject obj = jsonArray.getJSONObject(i);
            tasks(i) = obj.getString("Task_title") + ".nn" + obj.getString("task_description");



My problem is that I’m not sure where to place the following code:

            button_copy.setOnClickListener(v -> {

                ClipboardManager clipboard = (ClipboardManager)getApplicationContext().getSystemService(getApplicationContext().CLIPBOARD_SERVICE);
                ClipData clip = ClipData.newPlainText("", obj.getString("Task_title") + ".nn" + obj.getString("task_description"));
                Toast.makeText(getApplicationContext(), "Copied to clipboard!", Toast.LENGTH_LONG).show();


I have tried placing it in the settextView, however when I land on the page and the text generates, it automatically copies – but I want this attributed to a button, rather than automatically copying.
For reference, the button in my activity_list.xml is button_copy.

copy – What is the data path of a file transfer?

copy – What is the data path of a file transfer? – Super User

google sheets – How to use a query to find a row of same name but last entry, then copy a value next to it (update request)

(This is an updated version of this question – I am trying my best to make myself clearer this time.)

I am trying to use a query to copy values from one column to another.

Both source and destination columns have a name on their left columns, and the name must match. The source names could be duplicated, and in that case, I would like to have the entry on the bottom. There could be empty rows as well.

If a name in the source is not found in the destination, then don’t copy it.

If a name in the destination is not found in the source, then leave the destination value blank.

Please see the picture.
demo picture

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123