Author Archives: Chris Makara

About Chris Makara

Since 2003, I have developed an in-depth of experience in Interactive Marketing & Digital Strategy, with a focus on SEO, Social Media & Demand Generation. I am an avid Football Fan, Golf Enthusiast & Ambidextrous Bowler. I can also be found on LinkedIn and Twitter.

The Amazing Trick to Scraping Instagram Data Using Microsoft Excel

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 Twitter scraper to get the Twitter 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!

Don’t want to create the Excel file? Click here to download my “ready-to-go” Instagram Scraper Microsoft Excel file.

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 Twitter scraper to get the Twitter 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.

[HOW TO] Brilliantly Scrape Twitter Data With Microsoft Excel

Who doesn’t love data? Not just Data who was in Goonies, but cold hard Twitter data?

Back in the day (I guess I am showing my age here), the character Data had all the gadgets in Goonies. No matter the situation he seemed to always have some contraption that bailed himself (and others) out of trouble. Twitter has tons of data to bail you out of a jam. Whether it is content creation ideas, targeting the right followers, or even seeing what your competition is up to.

While there are countless tools that provide insight into Twitter data, chances are you have said, “there has to be a way to do this in Microsoft Excel.” If not, now I might have you thinking.

The bad news is it is not a straight forward process. The good news is, I figured it out how to export Twitter data to Excel and will share the details on how to do it through some trial and error after reading this post from Matthew Barby. If you know of a better/cleaner way to construct any of the formulas, please let me know in the comments below.

With this Excel spreadsheet, you will be able to pull in most data from any Twitter user, including first and last name, location, bio, URL, number of Twitter followers, number of Twitter users they are following, number of tweets, how long ago they last tweeted, and the content of their latest tweet. This info is very handy if you are trying to analyze certain Twitter users. Continue reading

My #1 Top Secret Trick to Remembering Blog Topic Ideas

We’ve all been there. You have thought of the best blog idea EVER! Unfortunately, you are nowhere near a computer. No worries, there is no way you will forget this topic.

Nope, not this time.

Let’s fast forward to the moment when you finally sit down to write your epic blog post. What was it you were going to write about? Surely you remember? Right?

Don’t Fool Yourself

If you are like me, chances are you won’t remember the exact topic you were planning to write about. Sure, you might remember the general idea you originally came up with, but will you remember all the details?

This has happened to me more times than I can remember…so I looked for ways to make sure it doesn’t happen again. Continue reading

[HOW TO] Use Instagram to Turbo-charge Your Small Business With Ease

Most small business owners and marketers focus on the “big fish” of social media sites for their social efforts and lead generation. Commonly, they look to Twitter, Facebook, and LinkedIn for generating leads. However, many are neglect using Instagram for business marketing.

With over 200,000,000 (yes, that is 200 million) active monthly users, there is no reason your business should not be looking at ways to use Instagram for business to explore opportunities for cultivating meaningful relationships with current and potential customers. Continue reading