Friday, September 9, 2011

Automated downloading of an entire Salesforce Data Export

UPDATE: This is now available for free as part of the Fuse IT SFDC Explorer.


I recently needed to download an entire Salesforce Weekly Data Export where there were 62 zip files at 130 megabytes each to individually select and save locally.

Rather than manually working through all the downloads I extended S4S/G4S to download and save all the files.

You pass it:

  • A SalesforceSession, which can be established a number of ways. Typically with a Salesforce user name, password, and security token.
  • an export id. E.g. (092xxxxxxxxxxxx). This can be seen in the download Urls
  • The base name of each export file - E.g. WE_00D9xxxxxxxxxxxAAA_{0}.ZIP
  • the number of files in the export - e.g. 62
  • where to save the files to locally

S4S/G4S will then work through all the zip files and save them to the specified directory.
In the future I could probably automate getting the export id and base file name. But for now I can churn through all the weekly data exports with no user interaction.