How to Mass Export Instagram Users & Bio URLs with Google Sheets

With stronger restrictions hitting the Instagram API, it's becoming harder and harder to export Instagram follower analytics from third party sources. Luckily, I created a nice hack to both get lists of Instagram followers (without using any external service) and then using that list to get the URLs of those account holders. And, best of all, the bulk of the process is automated in a Google Sheet. The strategy is a little lengthy to set up. Yet, once set up in a Google Sheet, it's very powerful and can quickly export and parse thousands of Instagram accounts. As such, I've outlined the basic parts of the guide to help you get a sense of the overall strategy.

  1. Decide on an Instagram account to scrape followers from
  2. Export that list of Followers using your browser console
  3. Use Google Sheets to index their bio URLs

Bulk Exporting Instagram User Details and URLs

This guide will cover roughly three major sections. First, we'll have to generate a list of Instagram users to get URLs from. Second, we'll have to scrape each of the accounts we generated for bio URLs. Last, we'll be outputting all of this data to the sheet. That being said, the process is very quick and you'll be able to repeat the process many times, so over time, you can use this strategy to get info on quite a large number of users and URLs. 

Exporting a List of Instagram Users

As stated above, the first step in our process will be to get a list of Instagram users to extract bio information from. And, if you've ever tried to get a list of Instagram users before, you'll have noticed that they are hard to get without signing up to some external service. It's hard to find a way to do it on your own. That being said, I have found a way to export Instagram user lists without using only your browser. 

  • First, you'll need to find an account for which you want to get the followers from. Typically, you'll want to use your own account or one that is in the same niche as yours. So once you've decided on an account navigate to it and click on the "Followers" button to list all of that account's followers.
  • A pop-up should then appear with a small list of their followers. You'll want to make that list bigger so keep scrolling down to get as many followers showing on the page as you need.
  • Once you've got all of the followers you need loaded on to the page, right-click on the page and click "Inspect Element".
  • This will bring up the browser console. In the console, we'll want to enter a command that will paste all of the links on this page so we can easily extract them. To do that, click on the "Console" tab as shown below.
     
  • Next, you'll want to paste the following code as shown below in the console and click enter: 

urls = $$('a'); for (url in urls) console.log ( urls[url].href );

  • You'll instantly see links pop up in the console for each of the followers in that list.  Simply drag to select all of the links and copy that list to an open Google Sheet in column A.

Cleaning Up the List of Followers

In the last step, we successfully generated a list of followers using only the browser. However, when copying them, we likely got some extra characters before the follower URLs that we don't need. To get rid of them, paste the following formula in Column B, next to the follower URLs you just pasted in the sheet.

=trim(REGEXEXTRACT(A2," .*"))

Drag this formula down the entire list and after we should have a nice clear list of the URLs of the user's accounts.

Exporting Instagram Bio URLs

Now that we have a full clean list of user accounts, we'll want to scrape them for the URLs that they possess. Since I have completed the proper formulas to complete this tasks, this step will be pretty simple. 

  1. First, copy the following formula into cell B1 of a new sheet. This formula gets the HTML of the account URL in a format that Google Sheets can parse.  =index(IMPORTXML(A1,"/"),6)
  2. In cell C1, copy the following formula. It will parse the imported HTML file and look for a bio URL. Once found, it cleans it using REGEX formulas. 

    =iferror(regexExtract(trim(clean(regexreplace(regexreplace(regexreplace(regexreplace(mid(B1,SEARCH("linkshimmed",B1),search("biography",B1)-SEARCH("linkshimmed",B1)),"linkshimmed",""),char(34),""),":",""),",",""))),"\%3A%2F%2F(.*)\%2F"),"")
     
  3. Next, you'll want to drag these formulas down your sheet to equal the amount of URLs you have to scrape. To do this quickly, select both B1 and C1 cells and hover over the bottom right corner of cell C1. A plus symbol should appear. When this happens, click and drag all the way to the appropriate row. This will properly copy your formulas with the correct cell references.
  4. Before pasting in the URLs in column A, make sure to hide column B by right clicking on the column header and selecting "Hide". This is important since when column B goes to import the follow account URLs, the sheet's formatting will go in disarray. So once that's hidden, you can go ahead and copy all the follower account URLs you got in the first step into column A. You'll need to wait a minute, but you'll soon start to see bio URLs appearing in cell C1. 

With that last complete, you will have successfully completed the bulk export of Instagram user details & Bio URLs with a Google Sheet. Once the sheet is setup, it will be very easy to repeat this strategy over and over again to obtain more URLs. It is especially useful for those who want to promote their work or products to other website owners or for SEOs who want to quickly perform blogger outreach for a link building strategy. For instance, since the URLs generated by this strategy will likely be website owners in the same niche as yours, a good strategy is to ask them to share your product or add a link to your site.