INDEPENDENT DEVELOPER REFERENCE
DraftKings data in Google Sheets and Excel
Load observed rows into Google Sheets with Apps Script and into Excel with Power Query, with the key kept out of cells and quota in check.
Editorial review: · Not a live coverage report
Why IMPORTDATA does not work
Every endpoint requires an Authorization header. Google Sheets' IMPORTDATA and IMPORTHTML cannot send one, and the API rejects keys in URLs, so those formulas return an error. Apps Script in Sheets and Power Query in Excel can both send headers, and each stores the key outside the grid.
Google Sheets with Apps Script
Apps Script runs on Google's servers, so it can call the API with a key held in Script Properties. The Sheets script reads one page per refresh into a sheet tab.
- In your sheet, open Extensions, then Apps Script, and paste the file's contents.
- Open Project Settings, then Script Properties. Add
DRAFTKINGS_API_KEYwith your key. - Run
refreshPick6Boardonce from the editor and grant the permissions it asks for. - Adjust the sport, stat and limit values at the top of the script.
function fetchPage_(path, params) {
const key = PropertiesService.getScriptProperties().getProperty("DRAFTKINGS_API_KEY");
const query = Object.keys(params)
.map((name) => name + "=" + encodeURIComponent(params[name]))
.join("&");
const response = UrlFetchApp.fetch("https://draftkingsapi.com" + path + "?" + query, {
headers: { Authorization: "Bearer " + key },
muteHttpExceptions: true,
});
const body = JSON.parse(response.getContentText());
if (response.getResponseCode() !== 200) throw new Error(body.error.message);
return body;
}Never paste the key into a cell. Anyone with view access could read it, and it would travel with every copy of the sheet. Sharing a sheet shares values, not Script Properties, but editors can still run the script and read script settings, so give edit access with care.
Refresh on a schedule
In Apps Script, add a time-driven trigger from the Triggers panel. Set it based on your allowance. Each page costs one request, so a trigger running a three-page refresh every hour uses about 2,160 requests in a 30-day month, more than the Free plan includes.
| Plan | Requests per month | Even spacing if this job is your only traffic |
|---|---|---|
| Free | 500 | One request every 86 minutes |
| Developer | 10,000 | One request every 4.3 minutes |
| Production | 50,000 | One request every 0.9 minutes |
Keep triggers infrequent on Free: a daily refresh of a few pages leaves plenty for testing. Do not attach calls to cell recalculation or sheet-open events, because they can run far more than you expect. Worker targets are five minutes for Pick6 and sportsbook, so a sheet refreshed more often gets nothing newer.
Excel with Power Query
Power Query can read native Pick6 CSV with a Web.Contents call. Open Data, then Get Data, then Blank Query, and paste this into the Advanced Editor. For the first connection, choose Anonymous credentials, because the header in the query carries the key.
let
Key = Excel.CurrentWorkbook(){[Name="ApiKey"]}[Content]{0}[Column1],
Source = Web.Contents("https://draftkingsapi.com/api/v1/pick6/projections",
[
Query = [sport = "NHL", stat = "Shots on Goal", limit = "100", format = "csv"],
Headers = [Authorization = "Bearer " & Key]
]),
Parsed = Csv.Document(Source, [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]),
Promoted = Table.PromoteHeaders(Parsed, [PromoteAllScalars = true])
in
PromotedThis example reads the key from a one-cell table named ApiKey, which keeps it out of the query text but still leaves it in the workbook. Keep that workbook private, and delete the key before sharing it. Excel's data privacy prompts may ask you to set a level for each source.
Datasets without native CSV
Only Pick6 has format=csv. For sportsbook, DFS and statistics, Power Query can parse JSON using Json.Document(Source) and expand the data list. A simpler path is to run export-csv.py on a schedule and open the output: python3 export-csv.py --resource odds --sport NBA --max-pages 3 --out rows.csv. The CSV guide covers columns for each dataset.
Keep values meaningful
Spreadsheets make it easy to lose context, so keep these columns next to every value and add a banner for the capture time.
observed_at, so a reader can tell how old a row is.staleandis_paused, as columns or as conditional formatting.- The three Pick6 identity columns, as text, because large IDs can be damaged by number formatting.
selectionsas a JSON cell, or one column per side. Leave missing sides blank rather than filling them.
Pick6 rows carry standings multipliers such as 1.5x. A standings multiplier is not decimal odds, a probability or an established entry payout. Avoid a formula that treats it as a price. Salaries and American prices also have their own meanings, as the comparison guide explains. Do not publish the sheet to the web without checking your rights, because technical access is not a redistribution license.
Try it
Check the CSV in a terminal before you wire up a workbook.
curl --fail-with-body "https://draftkingsapi.com/api/v1/pick6/projections?sport=NHL&limit=5&format=csv" \
-H "Authorization: Bearer $DRAFTKINGS_API_KEY"Endpoint docs
Check the recorded data
Questions
Can I use IMPORTDATA with the API?
No. IMPORTDATA cannot send the Authorization header that every endpoint requires, and keys are not accepted in URLs. Use Apps Script with the key in Script Properties.
Where should I keep my key in Google Sheets?
In Script Properties, never in a cell. Remember that people with edit access to the script can read it, so use a dedicated key you can revoke.
Will a sheet use up my free requests?
It can. Each page refresh is one request. A three-page refresh every hour is about 2,160 requests in a 30-day month, well over the Free plan's 500, so use a daily trigger on Free.
Does Excel need CSV?
Power Query can read either CSV or JSON. Native CSV exists only for Pick6, and other datasets need JSON parsing in Power Query.
Related resources
Use native format=csv on Pick6 endpoints, and convert sportsbook, DFS and statistics JSON to CSV on your side with a working script.
DraftKings API quickstart: your first call in one minuteFor developers who want a response now: a keyless sample, then a free key, then an authenticated call. Not for production hardening or sportsbook player props.
DraftKings API freshness: clocks and stale rowsHow to read observed_at, source_updated_at, age_seconds and stale, what worker targets mean, and how to label data honestly.
Does the API export CSV?Pick6 endpoints accept format=csv, up to 100 rows per page. Sportsbook, DFS and statistics are JSON, so convert them on your side.
Independent service operated by DD Inc., not affiliated with or endorsed by DraftKings. Technical access is not a redistribution license. No wagering: this service does not place, recommend or settle entries or bets. Check sources and status for actual capture context.