1

i need to retrieve the page title from an URL i already have using Apps Script.

  var url= r.getValue();
  var title= magically_retrieve_title(url);
  setTitle(title)

How can i do that?

Chobeat
  • 3,445
  • 6
  • 41
  • 59

1 Answers1

5

If you want to get the title of the page at a 'normal' URL, then you can get the contents of the page using UrlFetchApp.fetch(url) and then parse the title tag.

If not, then please provide more information- what is r here ? What sort of URL are you working with ?

Srik
  • 7,907
  • 2
  • 20
  • 29
  • I think it's the right answer, but i have to call it from onEdit and it says i don't have permissions. How to solve that without requiring an interaction with the user? – Chobeat Jul 01 '12 at 18:20
  • There are restrictions on what you can do within the default onEdit function. Rename the function as, say, onEdit1 and then add this function to the list of triggers and have it run on edit. The two are different in what can be done within them – Srik Jul 02 '12 at 04:39