New Spreadsheet Row to YouTube Playlist
Let's start with extractVideoID().
Your regex /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&amp;\?]*).*/ doesn't guarantee the URL has a YouTube format. For example, the URL www.google.com/watch?v=01$@T$89h does match the regex and has the following groups: [&quot;www.google.com/watch?v=0123456&quot;, &quot;watch?&quot;, undefined, undefined, undefined, undefined, &quot;watch?&quot;, &quot;01$@T$89h&quot;], where the 7th group 01$@T$89h isn't a valid YouTube video ID.
I suggest you replace your regex with /^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/ (source). This regex only matches valid YouTube URLs format, and the 5th group is the ID of the video. Notice that a valid YouTube URL along with a video ID doesn't guarantee that the video exist. You can use YouTube.Videos.list() to test if the video for the given ID exists.
  if ( match &amp;&amp; match[7].length == 11 ){
    return match[7];
  }
  else if (!( match &amp;&amp; match[7].length == 11 )){ // equivalent of else {}
    // multiple attempts to replace
    return trimmedVideoID;
  }

The if..else if block is bad. If you find a match, you return the ID. Done. So extractVideoID() has only one purpose: if the URL has a valid format, return the ID. Otherwise, i.e., if it doesn't find a match, then extractVideoID() should return null.
if (match &amp;&amp; match[5])
  return match[5];

In your code, the else if block is opposite of the first if, so it is actually an else block. This also means that, altought you couldn't find any match, you are returning anything anyway, even if url is garbage like Lorem ipsum dolor sit amet, consectetur adipiscing elit..
Now, with addVideoToYouTubePlaylist().
pageToken = res.nextPageToken || &quot;&quot;;
The nextPageToken is a string for the next page, so unless YouTube.PlaylistItems.list() fails - and thow an error, stopping everything - it won't evaluate to false. And if it does, you are restarting all over again, possibly heading to the same falsy value thus creating an infinite loop.
for (var d=1,l=data.length; d&lt;l; d++) {
You can test d &lt; data.length directly for improved reading.
  var videoId = extractVideoID(data[d][0]);
  if (!obj[videoId]) {
  YouTube.PlaylistItems.insert({

You may want to test if the video with the given ID exists before of inserting it in the playlist.
  resourceId: {
    kind: &quot;youtube#video&quot;,
    videoId: extractVideoID(videoId)
  }

Without chaning extractVideoID() and passing a valid ID to it returns null.
sheet.deleteRow(d+1); // delete row after video is checked
When you delete row number d+1, what was in row (d+1)+1 now is in row d+1. Because of that, you need a counter of deleted rows, say r, and delete the row number d+1-r to compensate the upward &quot;shift&quot;.