Import TD Ameritrade Data to Sheets

TD Ameritrade has deprecated their API as part of their merger with Schwab. Users who have already been transferred to Schwab will be unable to access the endpoints listed in this article.

In this guide, we’ll walk through how to pull data from the TD Ameritrade API directly into Google Sheets, using the API Connector add-on for Sheets.


Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the TD Ameritrade API

The easiest way to get started with the TD Ameritrade API is through API Connector’s built-in integration.

  1. Select TD Ameritrade from the drop-down list of applications
  2. Under Authorization, click Connect to TD Ameritrade
  3. You will see a modal asking you to approve the connection. Click Allow.
  4. You’ll then be returned to your Google Sheet, and can verify that your connection is active.

Part 2: Pull Data from TD Ameritrade to Sheets

Now that we’re connected, let’s pull some data into Sheets.

  1. Under Endpoint, choose /accounts to get information about your accounts
  2. Select a destination sheet, name your request, and click Run.
  3. Note the accountId as you can plug that into other requests.

Part 3: Create a Custom Request

Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the endpoints and parameters shown in the API documentation. Here's an example request setup.

  • ApplicationCustom
  • MethodGET
  • Request URL
  • OAuth: TD Ameritrade


Part 4: Example Custom API Requests

  • Option chains (set to 'grid' report style)
  • User Principals
  • User Transactions

Part 5: API Documentation

To see more API endpoints and example responses, check out out the TD Ameritrade docs located at

They also provide URL generator forms, you can see an example here:

16 thoughts on “Import TD Ameritrade Data to Sheets”

  1. how do you extract the complete json response for options data with the stock price and its ticker for along with the list of contracts ?

    • I'm not totally sure what you're looking for, but the example in the article shows how to get options data and customize the fields returned using TD Ameritrade's URL generator form. So I'd play around with the options in that form until you get what you want, then you can just copy and paste the URL they give you to see that same data in Sheets. If it's not available via that form then it means TD Ameritrade doesn't provide that data via API.

    • Sorry, I haven't connected to TD Ameritrade via OAuth2 as I don't have a TD Ameritrade account myself.
      This article shows how to create a custom OAuth2 connection:
      And TD Ameritrade's OAuth2 documentation is here:, with additional instructions here: Some of their info seems weird / inconsistent, like I don't see any mention of a client secret, and they only mention in one place that the client ID is [email protected]. So it would definitely require some testing.
      Update: I've added a preset OAuth connection for TD Ameritrade.

      • Never done API's before but trying to do this now. I'm struggling to figure out how to retrieve cash balance in Sheets from TD. Setup the API Connector, filled out the TD API link here
        This API has an OAuth 2.0 and I filled that in with login credentials and it shows I'm authenticated. I did not enter any header authorization/token because that's over my head and I feel like the OAuth 2.0 is authenticated so why wouldn't it work. Then I copied the cURL to the API Connector GET function on Google Sheets, ran it and it says "1) : Completed with errors - Invalid argument:" then the cURL code. If I need to supply a Header Parameter with the token thing I have no idea how to do this, but tried, just a foreign language to me. Any help is appreciated, you're user guide above worked well, it's just the actual account information that seems to be tedious.

  2. Great product! Awesome and the trial is going well so far.

    I'm trying to use the IMPORTAPI function along with TD Ameritrade API to create a put options screener. I want to use the ticker symbol (in column A) along with the strike price and expiration date using using "&A1&", "&B1&", "&C1&" within the URL portion of the formula to reference these variables.

    What is the best way to do this b/c when I create the initial API connector, a ticker symbol, expiration date, strike price is required to create the initial URL for the but I will be updating this in each cell formula based on the row.

    Another option would be to use a separate sheet and run the API connectors for several ticker symbols then vlookup, but I'd prefer the IMPORTAPI if possible. Thanks in advance for any help you can provide.

    • Hey Stan, when you use IMPORTAPI you can override the URL saved in the base request, so it doesn't really matter what you put in there. Just save a request with the setup options you're interested in (e.g. choose your report style, edit the fields, and so on).
      If you then save that request, let's say as "Options", you can then make an IMPORTAPI query like this:

      That way whatever values you add into those cells will dynamically become part of your IMPORTAPI request.

  3. Thank you for the info on creating a custom OAuth for TDAmeritrade. Following your instructions above I discovered that the Callback URL on TDAmeritrade API creation site requires the Callback URL found on your creating a custom OAuth2 connector page. With out it, it provides a security warning and doesn't provide the TDAmeritrade login page, however...

    With that API updated, I went back to my Google Sheet, clicked on the Connect button under my TDAmeritrade Custom Connections. It now provides me the TDAmeritrade authorization page to login. I enter in my info, successfully login, but it now gives me an Access Error page from The error begins as follows: "An error has occurred: Error: Token response not valid JSON: SyntaxError: Unexpected token"

    Any suggestions?

    • Hey Ben, sorry, I think I need a TD Ameritrade account to properly troubleshoot this one. I’ll investigate and try to add a preset connection for this one in the next few months.
      Update: added a preset connection for TD Ameritrade, please check it out!

    • Thanks Jonathan! Their /accounts endpoint description says "Account balances, positions, and orders for all linked accounts" so it looks like that's the one. But if it doesn't have enough detail I think you'd need to calculate it yourself by getting transaction data from the /transactions endpoint.

  4. Trying to register for a TD Dev Account here:

    Results in:
    "Encountered an Error. Please go back to our site"

    Which redirects you to the homepage:

    Which says:
    "New user registration for the TD Ameritrade API has been disabled in preparation for the Charles Schwab integration. Click here for more information on the API program as related to integration."

    Which redirects you here:

    Since the date of these instructions is Jan 2023, but the Schwab acquisition has been announced for over a year now, where are your updated instructions to set up your API with TDA as of now?

    Thank you

    • Sorry for the confusion, seems they recently disabled accessing the API through a key in preparation for the Schwab integration. I removed that section. That means you have to connect through our OAuth connection instead as that will continue to work through their migration. The integration guide says they haven't enabled the Schwab developer portal yet, so there aren't any updated instructions to share yet, but we'll add that once it's available.


Leave a Comment

Jump To