title: Convert Hyperlink in Google Sheets to URL using VBA
body: <p>I have a spreadsheet of hyperlinked text. The anchor text are words that are hyperlinked. </p>
  
  <p>I want to take the links underneath the text and either replace the text with the raw url or add the urls to another column.</p>
  
  <p>I've managed to find a tutorial that does this perfectly in MS Excel using a macro, but I can't seem to find a way to do this in Google Sheets as my working computer does not have MS Excel. The only things I can find for Google Sheets is a way to extract the url from cells using the <code>Hyperlink()</code> function, which I am not using.</p>
  
  <p>Is there a way to translate this macro into a GAS script for Google Sheets or any other way to grab the urls from hyperlinks?</p>
  
  <p>MACRO/VBA/Excel:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Sub removeHyperlinks()
  Dim Cell As Range 
  For Each Cell In Intersect(Selection, ActiveSheet.UsedRange) 
      If Cell.Hyperlinks.Count &gt; 0 Then 
          Cell.Value = Cell.Hyperlinks.Item(1).Address 
      End If 
  Next
  End Sub
  </code></pre>
  
  <p>source: <a href="https://www.youtube.com/watch?v=012u3YVo9pw" rel="nofollow noreferrer">https://www.youtube.com/watch?v=012u3YVo9pw</a></p>
  
  <p><strong>EDIT:</strong> In trying to translate this into from VBA to GAS I am encountering <code>Cell.Hyperlinks.Count.</code> There doesn't seem to be a GAS equivalent for <code>Hyperlinks</code></p>