Google Apps | Tutorial
How To Extract the Date from a URL in Google Sheets (or Any Spreadsheet)
This question comes up often in user forums: How do I extract a piece of information from one column and put that extracted information into another? For example, if I have a URL in one column, can I extract the date from that URL and put it in the date column so I don't have to add the date manually?
Why yes, you can.
Here it is in action in a sample spreadsheet. In this Sheet, I manually insert a URL in column B, and then the date is extracted in Column C.
Sample Google Sheet showing the date extracted from a URL.
This is a simple matter of using a not-so-simple formula, which you can see in the function field in the image above.
That will extract the date from URLs like:
Actually it's pretty simple for you because all you have to do is copy and paste it into your spreadsheet and then modify it slightly to make it function properly. (Incidentally, while this tutorial is about Google Sheets, this formula will also work in LibreOffice and other spreadsheets.)
Here's what this means:
Parsing the Date Extraction Formula
||This is the operator. You need this part.
||This is the specific cell we're referencing (column B, row 2). Modify this to suit your needs.
||Here we're saying we need to look for some specific text.
||This is the specific text we want to find. This is arbitrary in my case. I could have used "/articles/" or "icles/" or any other portion of the URL common to all of my URLs.
||Here we're restating the cell in which the text appears.
||This means I will exclude the first character in the searched text (the "/" in this case) when displaying the final result. If my search text had been "/Articles/," this number would be +10.
||This is the number of characters to be displayed from the starting point, which is 10 (for example, "2014/04/08"). If you wanted to display a slash at the end, you'd make this number 11. If you wanted to include only the year and the month, you'd make this number 7 (to exclude the "/08").
Now play around with it using your own URLs. If you run into any trouble, ask me a question in the comments section below.
Executive Producer David Nagel heads up the editorial department for 1105 Media's education publications — which include two daily sites, a variety of newsletters and two monthly digital magazines covering technology in both K-12 and higher education.
A 21-year publishing veteran, Nagel has led or contributed to dozens of technology, art and business publications.
He can be reached at email@example.com. You can also connect with him on LinkedIn at linkedin.com/profile/view?id=10390192 or follow him on Twitter at @THEJournalDave (K-12) or @CampusTechDave (higher education). A selection of David Nagel's articles can be found on this site.