The Amazing Trick to Scraping Instagram Data Using Microsoft Excel

Table of Contents

While Instagram might not be for everyone, there are countless businesses getting started on Instagram. However, what if you need a quick glance into some Instagram user data? Sure, there might be some tools out there that can give you more detailed data...but I needed something quick and easy that would let me copy and paste a list of Instagram usernames into it and then give me some basic stats for the users. My choice of tool for this job was Microsoft Excel. I've had great success with my Twitter Dashboard for Microsoft Excel, and it only made sense to make one for Instagram.
Please note that with the recent Instagram API changes, this approach is not currently working. Once I find an alternative solution I will be sure to post it. 
To do this, you will only need two things:
  • Microsoft Excel
  • Niels Bosma's SEO Tools Excel Plugin
Need a More Advanced Instagram Scraper? Contact me to discuss the development of a custom scraper to get the data you need.

Setting Up Microsoft Excel To Scrape Instagram Data

In order to get the Instagram account data to magically appear in Excel, we first need to install the SEO Tools Excel Plugin. Niels' site provides the installation instructions which are pretty easy. When installed, this plugin will allow us to gather data from URLs and instantly pull external data into Excel. Please note that this MUST be installed in order for the steps I provide below to work. Once you have downloaded it and activated it in your Microsoft Excel add-ins menu, you should see the SEO Tools tab in the top navigation ribbon. SEO Tools Excel If you have never used this in Excel, I highly suggest exploring all you can do with it. You will be amazed at what is possible!

Let's Get Instagram Data into Microsoft Excel

Now that you have installed Niels' SEO plugin, we can start creating some formulas that will get the data we are looking for. Initially, I was going to use Instagram's site to get the data; but I decided to go another route. To get the data I decided to use a site called Iconosquare.com - which provides various Instagram data for your account. Sure you can easily see stats of your own account. But what if you could easily view these same stats for others in Microsoft Excel? Before I lay out the process for setting up your Excel file to get this data, I want to quickly explain the process of how Excel is able to get the data. You will be using a feature of the SEO Tools plugin called "XPathOnUrl" which will allow you to get the data from the Xpath of a page. What is Xpath you ask? Xpath is a query language for selecting nodes from an XML document. It basically allows you to get values from a XML document. In other words, we are using this to scrape data from a website.

Setting Up The Excel File

You will need to start with a blank Excel sheet and add the formulas below where noted. Before we get to the formulas, we need to label our columns and create a table. Label the following cells as noted:
  • A1 - Instagram ID
  • B1 - Iconosquare
  • C1 - Username
  • D1 - Full Name
  • E1 - Bio
  • F1 - Personal URL
  • G1 - Followers
  • H1 - Following
  • I1 - Media Raw Data
  • J1 - Media/Posts
After the column headings are created, you will need to create a table. Simply highlight each of the cells you just created and then click "Ctrl+T" on your keyboard. You will then get a pop up asking you about the table, simply be sure to check the box that says "My Table Has Headers" and click "OK." Now let's move on to the formulas!
Need a More Advanced Instagram Scraper? Contact me to discuss the development of a custom scraper to get the data you need.

Instagram ID (A1)

In cell A2, we will enter the Instagram username of the profile we want to gather data for. Simply leave this cell blank or enter a profile name you would like to get the data of.

Iconosquare (B1)

For cell B2, we are going to populate the Iconosquare URL needed to pull up the profile you want the data for. Therefore, we will use the following formula:
=IFERROR(CONCATENATE("http://iconosquare.com/",[@[Instagram ID]]),"")
What this formula is basically saying is that if it returns an error (IFERROR), then the cell should render blank. If there is no error, then it will merge (CONCATENATE) the URL with the Instagram profile ID. You will notice that I use "IFERROR" on most of the formulas below.

Username (C1)

You will be pulling the username displayed on the webpage for cell C2. To do this, use the following formula:
=IFERROR(XPathOnUrl([@Iconosquare],"//h2[@class='username']"),"")
This formula is the first use of "XPathOnURL" which means we are now getting data from the website. It is essentially visiting the URL created in B2 and then looking for the value of the H2 tag with the class "username."

Full Name (D1)

Up next you will be creating a formula to bring in the full name that is being displayed on Instagram. In order to do this, use this formula:
=IFERROR(XPathOnUrl([@Iconosquare],"//h1[@class='fullname']"),"")
In this formula, it works similarly to the Username formula. The only difference is that we are looking for the H1 tag with the class of "fullname."

Bio (E1)

To grab the Instagram user bio data, in cell E2 use this formula:
=IFERROR(LEFT(TRIM(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']")),
FIND("~",SUBSTITUTE(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']")," ","~",
LEN(TRIM(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']")))-
LEN(SUBSTITUTE(TRIM(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']"))," ",""))))-1),"")
This formula visits the profile page and looks for the content in the class "clear bio-user" which is where the profile bio information is.

Personal URL (F1)

Some Instagram users enter a URL in their profile. Sometimes it is a personal URL, while others it is for a business. To pull this URL from Instagram into Excel, use this formula in cell F2:
=IFERROR(TRIM(RIGHT(SUBSTITUTE(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']")," ",REPT(" ",
LEN(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']")))),
LEN(XPathOnUrl([@Iconosquare],"//div[@class='clear bio-user unCommentContenuTexte']")))),"")
With this formula, it visits the profile page and gathers data from the anchor class "website-link."

Followers (G1)

One of the more notable social vanity metrics, this column will gather the number of followers for an Instagram account. In cell G2, use the following formula:
=IFERROR(XPathOnUrl([@Iconosquare],"//a[@class='followers user-action-btn']/span[@class='chiffre']"),"")
In this formula, it will gather the follower count from the span class "chiffre."

Following (H1)

To see how many users an Instagram account is following, we will collect that data in column H. In cell H2 enter this formula:
=IFERROR(XPathOnUrl([@Iconosquare],"//a[@class='followings user-action-btn']/span[@class='chiffre']"),"")
Using this formula, Excel will display the number of users an account is following.

Media Raw Data (I1)

This column is going to pull in the number of media posts (images/videos) an Instagram user has uploaded. So in cell I2 use this formula:
=IFERROR(XPathOnUrl([@Iconosquare],"//span[@class='photos user-action-btn user-action-btn-selected']"),"")
The result will show the number of uploads with the word "media" after it. In the next column we will remove the "media" text so it shows just a number.

Media/Posts

In order to remove the "media" text from cell I2, we will need to use the following formula in cell J2:
=IFERROR(LEFT(I4,LEN(I4)-6),"")
With this formula, the column will show only the number of uploads a user has made to Instagram.

Utilizing Your Instagram Data

Now that you have successfully created your Excel file (you got it working, right?), in what ways can you use this data to your advantage? Here are a few ways to get you started:
  • Identify users with specific keywords in their bio
  • Find users who do or do not have URLs listed in their profile
  • Determine which users post frequently and would be worth engaging with
  • Build reports on competitors
Need a More Advanced Instagram Scraper? Contact me to discuss the development of a custom scraper to get the data you need.
In what ways do you plan on using this data to your advantage? Be sure to let me know in the comments below.
70 Comments
  • Alex Cooper February 21, 2015

    You might be able to achieve something similar with IFTTT (https://ifttt.com) and Google Docs as well. This would continuously get your Instagram / social media information into a spreadsheet format.

    • Chris Makara February 21, 2015

      Thanks for the reply Alex. I don’t think this would work with IFTTT in that there is not a trigger for a new instagram follower. Ideally with the Excel (or even making this work in Google Docs) is that once set up you can simply re-run the formulas to pull new information.

      If you figure out a way to get it to work with IFTTT, let me know…I like using IFTTT for a few things 🙂 https://chrismakara.com/digital-marketing/6-ways-ifttt-can-increase-your-digital-marketing-productivity/

      • Patrick Henry January 12, 2018

        All this is great stuff do you think/know if this works (formular wise) with google sheets?
        so many marketeers need this info …
        I actually went the long way around and buitl my own product that did what IFTTT and google sheets and data for now shelved it let the big boys pick up the tab 😉

        • Chris Makara January 13, 2018

          Most scraping can work with Google Sheets…but this current method for scraping Instagram is not currently working as they made some API changes and I have not had time to come up with another solution.

          • rashelle February 24, 2018

            You Should definitely take this article off of the web if this isn’t a current version and the code no longer works. I just signed up for two of the apps you recommended as well as spent time creating the recommended excel sheet. You can also add a disclaimer at the top letting people know this method no longer works. Ahhhh I wish it was 2015 🙂

          • Chris Makara February 24, 2018

            There is a note in the first big yellow box at the beginning of the post 🙂

            I also wish it was 2015 and this worked…but things on Instagram have changed and unfortunately I have not had time to find a free work around to replace this yet…

  • Omar February 25, 2015

    Hey there! Great post.
    I’m planning to do an Instagram contest with my brand account. Do you think I could get all the comments of a photo, each one in a row with some extra data (e.g. username of the comment author, date of the comment, etc)?

    • Chris Makara February 25, 2015

      Thanks Omar. I think this is probably outside what Excel can do…however, I am sure I can get a custom desktop scraper application built that can get all of this. Drop me a line if you want to talk more about it https://chrismakara.com/contact/

  • Scott Stephens July 13, 2015

    Hey Chris – just discovering this article now. Where can I find the names of other values that can be brought in using XPathOnURL? For example I am trying to bring in the number of likes and comments by user from iconosquare.

    • Chris Makara July 13, 2015

      Hi Scott, you can use Chrome and then right click over the text/element and select “inspect element” for what you want to get data for. You will typically see the ID of the Xpath in the code. It can take some playing around to get it to work.

      As for # of likes and # of comments, I don’t think you can get this data in sum. It looks like it is only available for each individual piece of media. So you would need to build a spreadsheet that looks at each piece of media and get the data for each and then sum it up in Excel.

      This could become tedious if you have a user with hundreds of media. Of course, I could build a custom desktop scraper that could handle this if you needed it. Drop me a line at https://chrismakara.com/contact/ if you want to discuss details further.

  • Michael Valera July 17, 2015

    What i’ve been looking for Chris! Except, the SEO plugin doesn’t work on Mac. Any alternative here?

  • tastetap September 10, 2015

    formulas dont work here unfortunately, also I cant subscribe to the newsletter to get the ready made file..please help!

    • Chris Makara September 13, 2015

      Sorry you are having trouble…just tested my file and it works. Thanks for the heads up on the newsletter signup not working, I will look into it. To get the Excel file, drop me a line at https://chrismakara.com/contact/

    • seotoolsforexcel September 27, 2015

      Formulas won’t work if you copy from the blog directly into Excel as the ” and ‘ are “the wrong kind”.

  • seotoolsforexcel September 27, 2015

    Nice post! +1 for using SeoTools!

    • Chris Makara September 28, 2015

      Thanks! Your plugin is very useful – thanks for all the work you have put into it 🙂

  • Michael Dally November 1, 2015

    The “ready to go” excel file doesn’t seem to be working.

    • Chris Makara November 2, 2015

      Sorry about that Michael – can you send me an email here https://chrismakara.com/contact/ and I will send it to you.

    • Chris Makara November 3, 2015

      Can you please check the email address you used in the form? It is getting returned to me?

      • Michael Dally November 3, 2015

        earthrunner1987 AT gmail DOT com

        • Chris Makara November 3, 2015

          OK, just sent it 🙂

          • lukas November 4, 2015

            please send me this file too, tutorial doesnt work for me
            uookasz AT poczta DOT fm

          • Chris Makara November 4, 2015

            Sorry to hear you are having trouble, I’ve sent you an email…

          • marvaosky November 20, 2015

            Hey chris can you send me the ready to go file to my email? marvaosky AT hotmail com

      • Onathzky July 5, 2016

        The Excel I downloaded doesnt work either.. can I have a working one please.thank u!. onathzky AT gmail DOT com

        • Chris Makara July 6, 2016

          Unfortunately, Instagram recently changed their API so this is not currently working. I have not had time to find a new way to do it.

  • Siddharth November 9, 2015

    Hi Chris,

    I’d like to get the proflie details who has most followers count in the region of saudi arabia. Is there any way that i could find it by using filters?

  • Brody Hatch February 1, 2016

    @ChrisMakara:disqus – great article, but how can I get instagram followers and following counts triggered in an excel every 24 hours and on excel for mac? Any help is MEGA appreciated. Im stuck… 🙁 brody@brodyhatch.com

    • Chris Makara February 2, 2016

      You might be able to try disabling the cache function (http://seotoolsforexcel.com/caching/) and then it should update the data whenever you open the file.

      I have a version of this Instagram scraper working in Google Sheets if you are interested. I haven’t tested it extensively, but it seemed to grab the data without any issues.

  • Emanuele April 4, 2016

    I get errors, is not working for me, it gives me errors when i try to insert the formula.

    • Chris Makara April 4, 2016

      Did you install the SEO Tools for Excel plugin? Without that installed, none of the formulas will work. If you do have it installed and it is giving you a specific error, please let me know the error and I will look into it.

  • Le82 April 20, 2016

    Is there any chance to scrape UserId as well?

    • Chris Makara April 20, 2016

      Try this formula in a new column and let me know if it works. I tried it on a few names and it seemed to work for me…(you might need to do a find a replace for all the quotation marks as it will probably be formatted wrong if you copy/paste the comment)

      =IFERROR(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(MID(JsonPathOnUrl(CONCATENATE(“http://jelled.com/ajax/instagram?do=username&username=%5b”,$A2,”%5d&format=json”),”data”),FIND(“id”,JsonPathOnUrl(CONCATENATE(“http://jelled.com/ajax/instagram?do=username&username=%5b”,$A2,”%5d&format=json”),”data”))+6,15),”A”,””),”B”,””),”C”,””),”D”,””),”E”,””),”F”,””),”G”,””),”H”,””),”I”,””),”J”,””),”K”,””),”L”,””),”M”,””),”N”,””),”O”,””),”P”,””),”Q”,””),”R”,””),”S”,””),”T”,””),”U”,””),”V”,””),”W”,””),”X”,””),”Y”,””),”Z”,””),”a”,””),”b”,””),”c”,””),”d”,””),”e”,””),”f”,””),”g”,””),”h”,””),”i”,””),”j”,””),”k”,””),”l”,””),”m”,””),”n”,””),”o”,””),”p”,””),”q”,””),”r”,””),”s”,””),”t”,””),”u”,””),”v”,””),”w”,””),”x”,””),”y”,””),””””,””),”,”,””),”-“,””),”‘”,””)),””)

      If it does, then I will update the post with “some” detail around it…as you can see, it’s quite the formula 🙂

      • Vahid Bigdeli May 1, 2016

        Hi Chris.
        I want Instagram Meta data as well.
        So there must be two Sheets or formula,the first one to grab media links and another gets post meta data like likers or numbers of likes,etc.

        Regards,
        Vahid.

        • Vahid Bigdeli May 1, 2016

          Or at least 1 formula to list Instagram profiles media URLs…

          Sorry for my bad English

          • Chris Makara May 2, 2016

            I think I understand what you are saying, which I think is outside of what Excel can do? If you already have a list of the media then I am sure I could figure it out in Excel…but it sounds like you want Excel to get everything for you?

          • Vahid Bigdeli May 3, 2016

            Yeah,I want to get my or others instagram posts and also get their number of likes to be able to sort or filter by dates.

            I am sure it’s possible.

          • Vahid Bigdeli May 3, 2016

            Something like this which can grab all the meta data and all the images from a profile.
            http://www.barattalo.it/demo/minibots/test2.php

            Then I can use Excels sorting/filtering features to get what I want daily.

          • Chris Makara May 4, 2016

            I know it’s possible to get that data with php like the link you posted, but don’t think you can make Excel do that? Maybe with VB but I’m not good with that. Now there might be a way to get maybe the last 5-10 items posted from a user with Excel, but not all of them. I would need to dig a bit deeper.

  • SocialPhoto Inc. May 7, 2016

    I’m testing your spreadsheet. Working great except Bio and Personal URL are not populating. You aware of any change needed in the formula?

    • Chris Makara May 8, 2016

      Thanks for the heads up…just updated those formulas. Please let me know if you have any issues with them.

      • AMIR AHMADI May 14, 2016

        hi chris
        do you can send for me excell file that make formul for cash instagram id?
        i dont can make excell file for this your method

        • Chris Makara May 16, 2016

          Not sure what you mean by “cash instagram id”?

          • AMIR AHMADI May 16, 2016

            Join the discussion I need excel file that I can cash all followers in Instagram account?

          • Chris Makara May 17, 2016

            Do you mean “cache”? So basically scrape all followers of an Instagram account? I don’t think this is possible with just Excel as Excel can’t make the page scroll, perform actions, etc. If you have a budget, please contact me and I can get you this data.

  • Kevin June 11, 2016

    Hi Chris,

    It seems that this no longer works due to Iconosquare changing their format. Is there any way to fix this? I was trying to implement Instagram as the source, but when changing the class title, it still appeared blank.

    Thank you again for your help in advance!
    -Kevin

    • Chris Makara June 12, 2016

      Hey Kevin, yeah the recent Iconosquare/Instagram change made this method not work anymore. I have not had time to find an alternative to update this yet. When I do, I will be sure to update this post.

      • Kevin June 15, 2016

        I really appreciate your help with this! Great stuff as always.

        Thanks,
        Kevin

        • Bassam Kazerooni August 3, 2016

          Hi Chris,

          I hope all is well with you. Have you managed to find an alternative solution. I have a list of 4500 usernames that I need the profile pictures links for.

          I tried doing it through an excel plugin called blockspring. It works fine but its very manual.

          Would you be able to help?

          regards,

          Bassam

          • Chris Makara August 4, 2016

            Hi Bassam – I have not found an alternate solution yet. I looked at Blockspring as it isn’t something I have used, but it looks interesting. However, it looks like it is a paid tool? I was really hoping to find a free solution…

          • Michael September 29, 2016

            I am highly interested in this. When you get it working again, please let us know.

          • Michael Bay September 29, 2016

            I am very interested in getting this to work again, as it is especially the bio information that is so useful for understanding the user and only paid tools offerextraction of that.

  • yousaf November 24, 2016

    i just need followers of the instagram which are more than 200k will it work for it.. please elaborate the method

    • Chris Makara November 25, 2016

      This will not work for it. Instagram search doesn’t let you search by follower sizes, so you would have to scrape a list of Instagram users and then scrape their follower count. In Excel you would filter to show only account with 200k followers.

  • Victor March 6, 2017

    Do you know how can i grab geolocation data from instragram?

    • Chris Makara April 8, 2017

      Sorry for the late reply…but you’ll probably need a custom solution built out to do this. Drop me an email if this is something you would be interested in.

  • steen lundsteen April 7, 2017

    Hey Chris

    I have downloaded your “ready-to-go” Instagram Scraper Microsoft Excel file, SeoTools, installed key, and punch in a instagram id, absolutely nothing happens, except from Iconosquare link appearing in column b. Is there more I have to do, or is it not working anymore? I would like to get main data for own id/profile and those of selected competitors.

    • Chris Makara April 8, 2017

      Hi Steen – Yeah, it’s not working anymore since Instagram made some changes to the API several months back which caused Iconosquare to require a login in order to use it. However, data can still be scraped from Instagram but it requires a desktop scraper to be built out. If this is something you would be interested in talking in more detail about, please drop me a line – https://chrismakara.com/contact/

  • Matt Chx July 7, 2017

    Hey Chris,

    How can you put a list of username and then scrap it? When I enter a list in the excel tab it asks me to enter ONE username into the search box..
    Thank you

    • Chris Makara July 7, 2017

      Hey Matt, thanks for dropping by. Unfortunately, Instagram updated their API a few months back which makes this spreadsheet no longer work like it did and I have not had time to find a work around for it. But once I do, I’ll be sure to update the blog post.

  • Marcel September 24, 2017

    can you plz send me the ready to go speed head
    I don’t reserve it when I verify my Gmail.

    • Chris Makara September 25, 2017

      Hey Marcel – unfortunately Instagram made some changes where this currently does not work. Once I figure out a new way to do it, I will be sure to update the post.

  • Natasha April 4, 2018

    Hi Chris, Is there an updated spreadsheet yet? This solution is exactly what I need.
    Thank you for your help!

    • Chris Makara April 4, 2018

      Unfortunately I do not. However, if you really need data scraped please fill out the contact form on my site and we can discuss some different options.

  • Fierif November 17, 2018

    hi Chriss,
    Can you help me please with:
    How to export instagram post likers usernames?
    Thanks!

Leave a comment