Skip to content

Instantly share code, notes, and snippets.

@benpixel
Last active October 3, 2017 21:31
Show Gist options
  • Save benpixel/8720398fadb262b691ed4f8d54f9dcfe to your computer and use it in GitHub Desktop.
Save benpixel/8720398fadb262b691ed4f8d54f9dcfe to your computer and use it in GitHub Desktop.

Twitter Followers in Google Docs Spreadsheet

Example 1. Followers

=IMPORTXML("https://twitter.com/intent/user?screen_name=benjam1n", "(//dd[@class='count']//a)[1]")

Example 2. Following

=IMPORTXML("https://twitter.com/intent/user?screen_name=benjam1n", "(//dd[@class='count']//a)[2]")

Note: Only thing that's different is the number at the end

Example 3. URL column

=IMPORTXML(SUBSTITUTE(B1,"https://twitter.com/", "https://twitter.com/intent/user?screen_name="), "(//dd[@class='count']//a)[1]")

Note: Assuming you have column (e.g. B2) with URL to Twitter profile (e.g. https://twitter.com/benjam1n)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment