The base64 encode script is here, you can add it to your script then use it as a formula.
=BASE64(URL)
To automate that, add in the copy down trick.