Retrieve Scryfall results from inside Google Sheets
To install, copy the contents of scryfall-google-sheets.js.
Once you've copied it to your clipboard, open your sheet and go to Extensions -> Apps Scripts. Paste the contents of
your clipboard into the script editor and choose to save. Once you've done so, return to your spreadsheet
and the =SCRYFALL()
function should now be available.
SCRYFALL(query, fields, num_results, order, dir, unique)
* `query`: Scryfall search query
* `fields`: List of fields from a card object to return, using `.` for nested items (e.g. prices.eur)
* `num_results`: Number of results to return (maximum 700)
* `order`: The order to sort cards by, "name" is default
* `dir`: Direction to return the sorted cards: auto, asc, or desc
* `unique`: Remove duplicate "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)