0

disclosure. I am not a programmer

For the past year or so I have been utilizing the Facebook Graph API to pull Facebook page "likes" into a spreadsheet so that I can track how many likes my page gets vs other pages of similar business. It is kind of rudimentary but it became cumbersome to have to visit every page each week to get the total page "Likes" so this my solution.

I was utilizing this formula...

=importjson(concatenate("https://graph.facebook.com/",APINames!$B11,"?access_token=",$B$1),"/likes","noHeaders")

I reference this post...

Get Facebook page like count for OpenGraph v2.10

Which states to use the a different URL to retrieve page likes.

https://graph.facebook.com/v2.10/<page-id>?access_token=<access-token>&fields=fan_count

When inputting the new URL in my formula function I still receive a reference error.

=importjson(concatenate("https://graph.facebook.com/v2.10/",APINames!$B3,"?access_token=",$B$1),"&fields=fan_count","noHeaders")

If anyone could point me in the right direction I would be very grateful. I have spent over an hour scouring the web for information as well as reading the new changelog for v2.10. I fear going back to the manual process!!

1 Answer 1

1

I'm not 100% sure, but you should try this:

=importjson(concatenate("https://graph.facebook.com/v2.10/",APINames!$B3,"?access_token=",$B$1,"&fields=fan_count"),"/fan_count", "noHeaders")

I think the brackets are on the wrong place, because you need to concatenate the url, the page-id (in APINames), the query parameter access_token, the access token form cell B1 and the fields query_parameter.

At least with this change I get a fan_count. Interesting use case, BTW.

3
  • Hi Norbert! That did not work :/ . I know the formula is correct. After more digging I am wondering if the IMPORTJSON script link is no longer applicable. I can run the query fine in the Graph API Explorer. My other option is to save a bunch of GET queries in the graph explorer but that is not nearly as nice as having it pull into my spreadsheet. Any other thoughts? Maybe I have something else set up incorrectly but I can't think of what, will keep searching. Thanks for helping!
    – Jason
    Jul 23, 2017 at 23:51
  • hm okay, I used this page to add the ImportJson Script to a Goole Docs spreadsheet. (medium.com/@paulgambill/…). I had to replace the commas with semicolons, but in the end everything was fine and this may be a locale topic. Anyway did you try to replace APINames!$B3 with a String? I try to isolate the problem ;)
    – Norbert
    Jul 24, 2017 at 7:58
  • So this is really strange. It started working again ... Yesterday I tried the new fan_count formula and it did not work. This morning when I loaded the sheet it autopopulated like normal. Who knows!! Thanks for your help Norbert.
    – Jason
    Jul 24, 2017 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.