Skip to content

plotly/salesforce-studio-reports

Repository files navigation

Salesforce Reports Connector for Plotly Studio

Pull Salesforce reports and dashboards directly into Plotly Studio. Each team member authenticates with their own Salesforce account — no shared credentials.


Setup (do this once)

Step 1 — Open Terminal

On Mac: press Command + Space, type Terminal, press Enter.

Step 2 — Install

Paste this into Terminal and press Enter:

pip3 install "git+https://github.com/plotly/salesforce-studio-reports.git"

If you see "Successfully installed salesforce-reports", you're done with this step.

Step 3 — Authenticate

Paste this into Terminal and press Enter:

python3 -m salesforce_reports auth

A browser window will open to the Salesforce login page. Log in with your usual Salesforce credentials (@plot.ly account). After logging in you'll see "Authentication successful" — you can close that browser tab.

Your credentials are saved locally on your machine only. No one else can access them.


Using it in Plotly Studio

In the Plotly Studio prompt, tell it to use Salesforce data. Examples:

Load a report as a chart:

Create a bar chart from this Salesforce data:
from salesforce_reports import SalesforceReports
sf = SalesforceReports()
df = sf.run_report("Pipeline by Stage")

Filter a report:

from salesforce_reports import SalesforceReports
sf = SalesforceReports()
df = sf.run_report("Open Opportunities", filters=[
    {"column": "CLOSE_DATE", "operator": "greaterThan", "value": "2025-01-01"}
])

List all your reports:

from salesforce_reports import SalesforceReports
sf = SalesforceReports()
print(sf.list_reports())

Load a dashboard:

from salesforce_reports import SalesforceReports
sf = SalesforceReports()
dashboard = sf.get_dashboard("Sales Overview")

All available operations

Reports

Method What it does
sf.run_report(name) Run a report, get a pandas DataFrame
sf.list_reports(search="Pipeline") List reports, optionally filtered by name
sf.get_report(name) Get report metadata
sf.create_report(name, type, folder_id) Create a new report
sf.update_report(name, name="New Name") Rename or move a report
sf.update_filters(name, filters=[...]) Update report filters
sf.delete_report(name) Delete a report
sf.list_folders() List all report folders
sf.share_folder(folder_id, user_id) Share a folder with a user

Dashboards

Method What it does
sf.list_dashboards(search="Sales") List dashboards
sf.get_dashboard(name) Get dashboard metadata
sf.refresh_dashboard(name) Trigger a data refresh
sf.update_dashboard(name, title="New Title") Update dashboard properties
sf.delete_dashboard(name) Delete a dashboard

Troubleshooting

"Not authenticated" error Run python3 -m salesforce_reports auth again.

"pip3 not found" Install Python from https://www.python.org/downloads/ then try again.

Browser didn't open / timed out Copy the URL printed in Terminal, paste it into your browser manually.

"Multiple reports match" error Use the report ID instead of the name. Run python3 -m salesforce_reports list to see IDs.


For admins

The Connected App is Plotly Studio Reports in Salesforce Setup > App Manager. Consumer Key: 3MVG9KsVczVNcM8z.hnxcA.MfJGL60eOXxFIgUbe588.um9teOiHlh7kMpWTrjpOUwnwCvstDsXDIYocUqF3c

Authentication uses OAuth 2.0 + PKCE (no consumer secret distributed). Each user's token is stored at ~/.plotly_sf/token.json on their machine.

To revoke a user's access: deactivate their Salesforce user, or go to SF Setup > Connected Apps OAuth Usage > Plotly Studio Reports > revoke their token.

About

Salesforce Reports & Dashboards connector for Plotly Studio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors