how to get the title from the url on google sheets by the url column
- User
how to get the title from the url on google sheets by the url column
Assistant
You can use the Google Sheets formula =REGEXEXTRACT(A1,"https?://.+/([^?#]*)(?:?|$)") to extract the title from the URL in cell A1. This formula uses the REGEXEXTRACT function, which extracts text that matches a regular expression from a given text string. In this case, the regular expression matches the protocol (http or https), the domain name up to the first "/", and then captures everything up to the "?" or the end of the URL in parentheses. This captured text is then returned as the result.
You can also use the IMPORTXML function to extract the title from the URL. Here is an example formula that uses IMPORTXML to extract the title from a URL in cell A1: =IMPORTXML(A1,"//title"). This formula imports the XML data from the URL in cell A1 and then selects the title tag from the XML data.
Note that these formulas assume that the URLs in your Google Sheets spreadsheet are all structured in the same way, with the title appearing after the last "/". If the URLs are structured differently, you may need to modify the regular expression or use a different formula to extract the title.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.