Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

json - Export Salesforce Reports as CSV (Java)

I'm trying to automatise the exporting of Salesforce Reports as CSV's, so far I've managed to authenticate in the Salesforce API but I couldn't find any proper documentation on how to export the Salesforce Reports as CSV's or any other examples of doing it.

I've understood that there is a chance that could not be done, but you can still export it as a JSON and convert it to a CSV using a library, although I didn't find anything.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you're authenticated (got session id back) you're almost there.

The hacky, not officially supported way is to send a GET request to the report export just like user would click a button. Check out How to download a report as a CSV directly from Salesforce Lightning? or Salesforce: Download Reports via URL in R examples (it's not Java but same principle). You'd have to send header that sets cookie with sid=sesionidgoeshere.

The more official way would be to use the reporting API


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...