Last active
December 13, 2018 01:35
-
-
Save nickboyce/eefdfb25c65529cfe3d13ba016e36625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initTwitterFollowerCount() { | |
insertTwitterFollowerCount("IG followers", "nickboyce"); | |
} | |
function insertTwitterFollowerCount(sheetName, username) { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getSheetByName(sheetName); | |
Logger.log(sheet.getRange("A1").getValue()); | |
sheet.appendRow([Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd"), getTwitterFollowerCount(username)]); | |
} | |
function getTwitterFollowerCount(username) { | |
var url = "https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names="+username; | |
var response = UrlFetchApp.fetch(url).getContentText(); | |
return JSON.parse(response)[0].followers_count; | |
} |
@LenaFR – looks like the quotes got messed up. Try again with the updated gist.
I'm also having issues getting this script to run correctly. It is still not registering the sheetname and username as specified in initTwitterFollowerCount() even though the quotes are updated. Any idea what would be happening?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having issues getting this script to run correctly. I think the issue is in line two? Are you able to advise?