On-Demand Bulk Insert Job from SharePoint CSV
Salesforce action: CreateJob_V2 + UploadJobData + CloseOrAbortJob. When a CSV is uploaded to a designated SharePoint folder, creates a bulk insert job, uploads the CSV data, closes the job to begin processing, and posts status to Teams.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
FlowLibs - On-Demand Bulk Insert Job from SharePoint CSV is an event-driven integration flow that kicks off a Salesforce Bulk API 2.0 insert job the moment a CSV file lands in a designated SharePoint document library. The flow runs "codeless" against Salesforce using the native Bulk API connector actions (no Apex, no custom objects required), validates the file extension, uploads the CSV payload, closes the job to begin processing, and broadcasts success or skip notifications to a Microsoft Teams channel.
This pattern is ideal whenever a business team owns the data but IT owns the load — drop a CSV in SharePoint, walk away, and the rows land in Salesforce.
Use Case
An operations analyst exports a batch of leads, accounts, or product records to a CSV and drops it into a monitored SharePoint folder. The flow polls every 5 minutes, detects the new file, and silently fires a Salesforce Bulk API 2.0 insert job. Teams is notified with the job ID for traceability.
The trigger is OnNewFile on a specific SharePoint library, so the flow ignores edits to existing files and only fires on genuine net-new uploads.
The flow is ideal for teams that:
- Weekly lead imports from a marketing data vendor into Salesforce Lead
- Nightly Account or Contact refreshes from an on-prem ERP exported to CSV
- Ad-hoc product catalog updates dropped by Merchandising
- Any high-volume one-way sync where SharePoint is already the landing zone
Flow Architecture
When A CSV Is Added To Import Folder
When a file is created (properties only)SharePoint OnNewFile trigger — polls the configured import folder every 5 minutes for genuine net-new file uploads. Ignores edits to existing files.
Init CsvFileName
Initialize variableCaptures the `x-ms-file-name` header from the trigger into a String variable (`varCsvFileName`) for reuse downstream.
Check Is CSV File
If conditionGuardrail check: `endsWith(toLower(variables('varCsvFileName')), '.csv')`. Ensures the flow only processes CSV files since SharePoint OnNewFile fires for any file type dropped in the folder.
- Get CSV File Content — SharePoint `GetFileContent` action — reads the raw CSV bytes from the newly uploaded file.
- Create Salesforce Bulk Insert Job — Salesforce `CreateJob_V2` action — opens a Bulk API 2.0 job for the configured object and operation with contentType `CSV`. Returns the `jobId`.
- Upload CSV Job Data — Salesforce `UploadJobData` action — streams the CSV bytes into the open job using the returned `jobId`.
- Close Job To Begin Processing — Salesforce `CloseOrAbortJob` action — flips the job state to `UploadComplete` so Salesforce picks it up and begins processing.
- Post Success To Teams — Microsoft Teams `PostMessageToConversation` action — posts a success card with the file name and Salesforce job ID for traceability.
Skip path — file does not have a `.csv` extension; post a skip notice so the run doesn't silently swallow bad files.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com/sites/FlowLibsDemo | Reused — the SharePoint site hosting the CSV import document library. |
| flowlibs_SfBulkImportFolderPath | String | /FlowLibs Salesforce Bulk Import | Library/folder path the trigger monitors. Note: SharePoint sometimes generates double-spaces in library paths — match exactly. |
| flowlibs_SfBulkImportTargetObject | String | Lead | Salesforce object API name to insert into (e.g., Lead, Account, Contact, Product2). |
| flowlibs_SfBulkImportOperation | String | insert | Bulk API 2.0 operation — one of `insert`, `update`, `upsert`, or `delete`. |
| flowlibs_TeamsGroupId | String | <configure> | Reused — the Microsoft Teams Group (Team) GUID where status notifications are posted. |
| flowlibs_TeamsChannelId | String | <configure> | Reused — the Channel ID inside the Team, in the format `19:<hash>@thread.tacv2`. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| SharePoint | shared_sharepointonline | OnNewFile (trigger) GetFileContent |
| Salesforce | shared_salesforce | CreateJob_V2 UploadJobData CloseOrAbortJob |
| Microsoft Teams | shared_teams | PostMessageToConversation (used twice — success and skip notifications) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Point the flow at a different Salesforce object
- Update flowlibs_SfBulkImportTargetObject (e.g., Account, Contact, Product2). Ensure the CSV column headers match the Salesforce API names for that object.
- Change the operation (upsert, update, delete)
- Update flowlibs_SfBulkImportOperation to the target op. For upsert, also add the externalIdFieldName parameter to the Create Salesforce Bulk Insert Job action body, and ensure the CSV includes that external ID column.
- Monitor a different SharePoint folder
- Update flowlibs_SharePointSiteURL if the site changes, and flowlibs_SfBulkImportFolderPath to the new library path (include any leading slash and SharePoint's double-space quirks).
- Reroute Teams notifications
- Update flowlibs_TeamsGroupId and flowlibs_TeamsChannelId to the destination Team/Channel. Channel ID format is 19:<hash>@thread.tacv2.
- Adjust polling frequency
- Edit the trigger recurrence (default 5 minutes). Polling under ~3 minutes can trip throttling on high-traffic tenants.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Capture uploaded file name
Reads the file name out of the SharePoint OnNewFile trigger response headers and stores it in `varCsvFileName`.
EXPR.02CSV extension guard
Used in the If condition; lower-cases the file name before the suffix check so `.CSV` and `.csv` both pass.
EXPR.03Pass job ID between actions
Pulls the `jobId` out of the CreateJob_V2 response so the subsequent UploadJobData and CloseOrAbortJob actions target the same bulk job.
EXPR.04File content binary passthrough
Streams the raw CSV bytes from the SharePoint GetFileContent action directly into the Salesforce UploadJobData body.
EXPR.05Close job state literal
Literal value passed to CloseOrAbortJob — this is what starts Salesforce processing. Skipping this leaves the job stuck in Open state.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.