jmc
jmc

Reputation: 1729

SalesForce: Export SOQL query results to CSV

How to export results from an SOQL query to CSV? Currently I'm using workbench.developerforce.com but I get an error when I try to use Bulk CSV.

Failed: InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Foreign Key Relationships not supported in Bulk Query

I'm guessing the Bulk API doesn't support queries with relationships, it's fine with single tables though.

I also tried using the Developer Console Query Editor but there is no option to export the results to CSV. Is there any other way to do this?

Upvotes: 2

Views: 11485

Answers (2)

Avijit
Avijit

Reputation: 1229

Though its very old post:

v39.0 API is currently supporting Relationship fields.

https://developer.salesforce.com/docs/atlas.en-us.204.0.api_asynch.meta/api_asynch/asynch_api_using_bulk_query.htm

v39.0 API - Bulk API query doesn’t support the following SOQL:

  • COUNT
  • ROLLUP
  • SUM
  • GROUP BY CUBE
  • OFFSET
  • Nested SOQL queries

For v38.0 API:- Bulk API query doesn’t support the following SOQL: COUNT

  • ROLLUP
  • SUM
  • GROUP BY CUBE
  • OFFSET
  • Nested SOQL queries
  • Relationship fields

Upvotes: 0

Daniel Ballinger
Daniel Ballinger

Reputation: 13537

The FuseIT SFDC Explorer has an option to export SOQL query results as CSV.

It can export the SOQL query results as CSV. This will handle paging through all the query results for you.
FuseIT SFDC Explorer Export SOQL results to CSV

Disclosure: I work for the company that makes this product. It is free to download and use.

Upvotes: 4

Related Questions