getTwitterSearch

Returns Tweets from a search term. This function only supports returning both popular and realtime results and a maximum of 100 tweets.

Function

=getTwitterSearch(serarchTerm, optResults, optCols)

Details

Columns returned

ColumnDescription
idTweet's ID number
id_strTweet's ID number
to_user_idTo user name
from_user_nameFrom full name
from_user_id_strFrom user ID
created_atDate Tweeted
profile_image_url_httpsProfile image
from_user_idUser ID
profile_image_urlProfile image URL
geoTweet's geo location
sourceService/device used to make the Tweet
to_userTo Twitter name
textContent of the Tweet
from_userTwitter user name
iso_language_codeLanguage code
to_user_id_strTo user ID
to_user_nameTo full user name

SearchTerm options

ExampleFind tweets ...
twitter searchcontaining both "twitter" and "search". This is the default operator
"happy hour"containing the exact phrase "happy hour"
love OR hatecontaining either "love" or "hate" (or both)
beer -rootcontaining "beer" but not "root"
#haikucontaining the hashtag "haiku"
from:twitterapisent from the user @twitterapi
to:twitterapisent to the user @twitterapi
place:opentable:2about the place with OpenTable ID 2
place:247f43d441defc03about the place with Twitter ID 247f43d441defc03
@twitterapimentioning @twitterapi
superhero since:2011-05-09containing "superhero" and sent since date "2011-05-09" (year-month-day).
twitterapi until:2011-05-09containing "twitterapi" and sent before the date "2011-05-09".
movie -scary :)containing "movie", but not "scary", and with a positive attitude.
flight :(containing "flight" and with a negative attitude.
traffic ?containing "traffic" and asking a question.
hilarious filter:linkscontaining "hilarious" and with a URL.
news source:tweet_buttoncontaining "news" and entered via the Tweet Button
Tips:
  • You cannot use a negation (the '-' minus sign)
  • Dates must be in YYYY-MM-DD format. Hint: Try using the =dateToYMD() function
  • Dates in Twitter are always UTC timezone
  • The start date can't be later than the end date
  • To have multi word searches, use an underscore instead of a space

Parameters

Name Type Description
serarchTerm string Search term
optResults string (Optional) Number of tweets to return (default is 25. Max is 100).
optCols array | range (Optional) Columns you want to get back from Twitter. Default columns: "created_at", "from_user", "to_user", "text"

Returns

Column Description
Twitter results

 

Cells:
A1: @wilreynolds
=getTwitterSearch(A1)      // Last 25 tweets containing "@wilreynolds"
=getTwitterSearch(A1, 50)  // Last 50 tweets containing "@wilreynolds"

// Get the date of the tweet, the tweet itself, and the 
// service or device they used to make the tweet.
A1: created_at
B1: text
C1: source
A2: =getTwitterSearch("#fml", 25, A1:C1)

// Get tweets sent to @djchrisle
=getTwitterSearch("to:djchrisle")

// Get tweets sent from @djchrisle
=getTwitterSearch("from:djchrisle")

// Get tweet containing the word "pinterest" and "seo"
=getTwitterSearch("pinterest_seo")

// Get tweet containing the word "pinterest" and "seo" 
// since Jan 15, 2012
=getTwitterSearch("pinterest_seo since:2012-01-15")

// Get tweet containing the word "pinterest" and "seo" 
// since Jan 15, 2012 but using a date in cell
Cells:
A1: 01/15/2012
=getTwitterSearch("pinterest_seo since:" & dateToYMD(A1))

// Get tweet containing the word "pinterest" and "seo" 
// since Jan 15, 2012 but using a date in cell and terms from cells
Cells:
A1: 01/15/2012
A2: pinterest
A3: seo
=getTwitterSearch(cellsToTwitterSearch(A2:A3) & "since:" & dateToYMD(A1))

Function

=getTwitterUserLookup(screenNamesRange, optCols)

Details

Returns information about one or more Twitter accounts

Limits

  • The maximum range is 100 twitter accounts.
  • Twitter's API limits you up to 150 calls per hour
  • Available columns

    (Default columns returned by this function are marked with a (*)

  • name
  • profile_sidebar_border_color
  • profile_background_tile
  • profile_sidebar_fill_color
  • location (*)
  • profile_image_url
  • created_at (*)
  • profile_link_color
  • favourites_count (*)
  • url (*)
  • contributors_enabled
  • utc_offset
  • id (*)
  • profile_use_background_image
  • profile_text_color
  • protected
  • followers_count (*)
  • lang (*)
  • verified (*)
  • profile_background_color
  • geo_enabled (*)
  • notifications
  • description (*)
  • time_zone (*)
  • friends_count (*)
  • statuses_count (*)
  • profile_background_image_url
  • Parameters

    Name Type Description
    screenNamesRange array | cells Cells of of twitter accounts to search
    optCols array | cells Columns you want returned from Twitter

    Returns

    Column Description
    Twitter results

     

    Cells:
      A1: djchrisle
      A2: wilreynolds
      A3: seerinteractive
    
    // Get default columns about the following Twitter users 
    =getTwitterUserLookup(A2:A3)