Retrieve Scryfall results from inside Google Sheets
- Copy the contents of scryfall-google-sheets.js.
- Open your sheet and go to Extensions → Apps Scripts
- Paste the contents of your clipboard into the script editor, then hit Save. (Nothing special will happen. You do not need to hit Deploy.)
- You're done! The
=SCRYFALL()
function should now be available on your spreadsheet. - Return to your spreadsheet. Pick any cell, focus the formula bar up to, and start typing
=SCRYFALL
. Its autocomplete should begin showing up.
=SCRYFALL(query, fields, num_results, order, dir, unique)
query
: Scryfall search query.fields
: A single string containing a space-separated list of fields from a card object to return, using.
for nested items (e.g. prices.eur). For example:"name type oracle_text power toughness"
num_results
: Number of results to return (maximum 700)order
: The order to sort cards by,"name"
is the default. You can find other sort orders in the API help for sorting cards.dir
: Direction to return the sorted cards:"auto"
,"asc"
, or"desc"
unique
: Find unique"cards"
(default),"art"
, or"prints"
.
If you are unsure what fields can be in a card object, here is an example.
As it can be difficult to describe how to use a function, here are some examples:
=SCRYFALL("type:creature pow>=10")
=SCRYFALL("set:dom", "name prices.usd prices.eur", 750, "price")
=SCRYFALL("in:paper -in:mtgo legal:legacy", "name", 700)
List of cards with Jaya Ballard flavor text, returning card name, set name, mana cost, and flavor text
=SCRYFALL("flavor:'jaya ballard'", "name set_name mana flavor")
Commander cards not available in foil, with name, set name, release date, color identity, URL, and oracle text, sorted by EDHREC popularity
=SCRYFALL("-in:foil game:paper legal:commander -is:reprint -is:reserved", "name set_name released_at color url oracle", 150, "edhrec")
Note that your search must return a result in 30 seconds or less. Asking for too many results can result in
your spreadsheet showing an ERROR. Repeating a =SCRYFALL()
function with the same query may work on a second
attempt, as Scryfall caches results.
If you want to have a spreadsheet with more than 700 results, your best bet is to shard your results. For example, if you wanted a list of all legal Commanders (which has over 1000 results), you can do:
=SCRYFALL("is:commander legal:commander name:/^[abcdefghijklm]/", "name", 700)
=SCRYFALL("is:commander legal:commander name:/^[nopqrstuvwxyz]/", "name", 700)