google-api,google-url-shortener
No it is not possible to shorten a youtube link into a youtu.be using googles url shortener. Think about it as all the url shortened links are under the website goo.gl/ goo.gl is just the name of the website.
google-apps-script,try-catch,url-shortener,google-url-shortener
The way you are referring to lng[i] is wrong. You have take the first value in the single dimensional array lng[i] as lng[i][0]. Made some changes to code. Try this function shorturl() { var sheet = SpreadsheetApp.getActiveSheet(); var lng = sheet.getRange(2, 1, sheet.getLastRow()).getValues(); try { for(var i=0;i<lng.length; i++) { if(lng[i][0])...
It seems I need to manually specify the key in the URL $result = file_get_contents("https://www.googleapis.com/urlshortener/v1/url?key=" . $apiKey, false, $context); This now works. There must be something funny with how the API inspects POST for the key (or lack of doing so). Edit: For anyone in the future this is my...