majid
majid

Reputation: 723

Run custom function ( for decoding url ) in spreedsheet

I export my search console result , because my Urls is persian it show that like this in spreed sheet .

enter image description here

I write a custom function for that .This is my custom function :

function decode(value) {
  return decodeURIComponent(value);
}

But my problem is i need run this function in the entire of column . how can i do this ? I need write decoded url in the front of same row with it . like this

enter image description here

Upvotes: 2

Views: 5727

Answers (1)

Parag Jadhav
Parag Jadhav

Reputation: 1899

This should do, check it out.

function test1()
{
    var sp = SpreadsheetApp.openById("my_spreadsheet_id").getSheetByName("Sheet1");
      var data = sp.getRange("A1:A").getValues().filter(String);

      for(var i=0; i<data.length;i++)
      {
        var uri_dec = decodeURIComponent(data[i]);
        sp.getRange("F"+(i+1)).setValue(uri_dec);
      }
}

Upvotes: 4

Related Questions