Live Editor for the Main Header Navigation of your WordPress Website
.accordion-flush
A App Script library is a App Script project whose functions can be reused in other scripts and other Google Sheets App Script Code Editors.
Sample Code for the External App Script Library
function getContents(uri) { var result = UrlFetchApp.fetch(uri); var contents = result.getContentText(); return contents; }
function Response(uri) { try { var options = { followRedirects : true }; var response = UrlFetchApp.fetch(uri, options); return response.getResponseCode() ; } catch (error) { return "Error"; } }
function MetaTT(uri) { var html = getContents(uri); const regexp = RegExp('','g'); var MetaTT = html.matchAll(regexp); var resultsArr = [] for (const match of MetaTT) { var clean = match[1].replace(/<[^>]+>/g, "").replace(/&/g, '&').replace(/ /g, ' ').replace(/©/g, '©'); resultsArr.push(clean); }
return resultsArr; }
function callMetaTT() { var uri = “https://example.com”; // Replace with the URL you want to fetch var results = MyLibrary.MetaTT(uri); // Logger.log(results); // Log the results to the Apps Script logger }
This workaround allows you to indirectly call the MetaTT function from a cell in Google Sheets. However, keep in mind that there might be limitations on the number of API calls you can make, depending on your Google Workspace plan.
If you want to call the MetaTT function directly from a cell in Google Sheets and pass a URL as an argument to fetch data, you can use a custom function. Unfortunately, custom functions in Google Sheets can’t directly call Apps Script functions that use the UrlFetchApp service due to restrictions on external API calls. However, you can create an intermediary function in the Apps Script editor that calls the MetaTT function and is then called from the cell.
Here’s how you can set it up the Apps Script on the New Sheet to use main Library Functions
In your Apps Script editor, create a new function that calls the MetaTT function with the provided URL
function callMetaTT(uri) { return MyLibrary.MetaTT(uri); }
Welcome to the SEO Book Pro Support Section Content