Skip to content

Instantly share code, notes, and snippets.

@erik4github
Created December 1, 2020 22:45
Show Gist options
  • Save erik4github/17aa0ce03977046741deeb7162fbdda3 to your computer and use it in GitHub Desktop.
Save erik4github/17aa0ce03977046741deeb7162fbdda3 to your computer and use it in GitHub Desktop.
Export records via SFDX into CSV or JSON
#!/bin/bash
# CSV with SOQL example
sfdx force:data:soql:query -q "SELECT Name, Username, Email FROM User WHERE IsActive = True" --resultformat csv | paste -sd '\n' >| sf_users.csv
# JSON with SOQL Example
sfdx force:data:soql:query -q "SELECT Name, Username, Email FROM User WHERE IsActive = True" --resultformat json >> sf_users.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment