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 my date column so I don't have to the 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 sowing the date extracted from a URL.
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.

=MID(B3,FIND("/20",B3)+1,10)

That will extract the date from URLs like:

http://campustechnology.com/articles/2014/04/08/4-emerging-principles-of-connected-learning.aspx

or

http://thejournal.com/articles/2014/04/08/a-third-of-secondary-students-use-school-issued-mobile-devices.aspx

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
Term Description
=MID( This is the operator. You need this part.
B3, This is the specific cell we're referencing (column B, row 2). Modify this to suit your needs.
FIND( Here we're saying we need to look for some specific text.
"/20", 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.
B3) Here we're restating the cell in which the text appears.
+1 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.
,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.

About the Author

David Nagel is the former editorial director of 1105 Media's Education Group and editor-in-chief of THE Journal, STEAM Universe, and Spaces4Learning. A 30-year publishing veteran, Nagel has led or contributed to dozens of technology, art, marketing, media, and business publications.

He can be reached at [email protected]. You can also connect with him on LinkedIn at https://www.linkedin.com/in/davidrnagel/ .


Featured

  • computer with a red warning icon on its screen, surrounded by digital grids, glowing neural network patterns, and a holographic brain

    Report Highlights Security Risks of Open Source AI

    In these days of rampant ransomware and other cybersecurity exploits, security is paramount to both proprietary and open source AI approaches — and here the open source movement might be susceptible to some inherent drawbacks, such as use of possibly insecure code from unknown sources.

  • Two shadowy figures sit at computers with glowing screens, surrounded by floating digital codes in a dark, high-tech environment

    Reports Note Increasing Threat of Nation-State-Sponsored Cyber Attacks

    A bevy of new cybersecurity reports point to the continuing problem of nation-state-sponsored threat actors. The primary culprits have long been Russia, China, Iran, and North Korea, which all show up in recently published reports from Microsoft, IBM, Tenable, and Fortinet.

  • man working on laptop outdoors

    Digital Leadership Must-Haves for 2025: A CDO's Picks

    Now that he's more than a year and a half into his chief digital officer role at NJIT, we've asked Ed Wozencroft to reflect on his areas of concentration: What work must digital leaders "own" in 2025?

  • interconnected cubes and circles arranged in a grid-like structure

    Hugging Face Gradio 5 Offers AI-Powered App Creation and Enhanced Security

    Hugging Face has released version 5 of its Gradio open source platform for building machine learning (ML) applications. The update introduces a suite of features focused on expanding access to AI, including a novel AI-powered app creation tool, enhanced web development capabilities, and bolstered security measures.