Forum Discussion
How to send an email with a csv attachment
- 8 months ago
Hi dyordanov,
If I were you, I would do the following.
If you created the files using Notebook, they are initially stored in the storage account. Then, in the pipeline (after Notebook), create a lookup activity that lists the files. Transfer this to a variable, which in turn transfers it to a web activity that controls the Logic APP.I hope that was reasonably clear 🙂
Here an simple Guide.
1. Lookup Activity
- Source: your Blob Storage container.
- Configuration:- First row only = false (so that all files are listed).
- Query or path filter: e.g., only files with a specific prefix or extension (.xlsx).
- Result: JSON array with all files found.2. Set Variable Activity
- Transfers the list from the Lookup Activity to a pipeline variable (e.g., fileList).
- Optional: You can transform the list (e.g., extract names only).3. Web Activity
-Target: your Logic App HTTP Trigger.
- Method: POST.I haven't tested this in this configuration yet, but I use something similar at our place.
Best regards
Feel free to leave kudos or accept it as a solution. This will also help other community members.
- 8 months ago
I understand :),
another option is to switch to Event Grid in the Logic APP. I've done that before, too.
You simply replace the trigger that triggers the action with When a resource event occurs (Azure Event Grid). I think that's what it should be called.The advantage is that you only get one event instead of multiple events.
Here is the procedure.
Go to the Storage Account and click Events.
1. Create and configure the event grid accordingly. Important: the event type is Microsoft.Storage.BlobCreated.
2. Change Logic APP.
- Remove the old trigger “When a blob is added or modified”.
- Add a new trigger:
- When a resource event occurs (Azure Event Grid) -
Configure:Subscription: your Azure subscription.
Resource Type: Storage Account.
Event Type: Microsoft.Storage.BlobCreated.I hope that helps.
Best regards
Hi dyordanov, currently it is not possible to add an email attachment to the Office 365 Email activity. Question is if it ever will be an option. As Fabric is all about not duplicating saved data, sending an attachment kinda is. So you have some other options.
- Don't send the file is attachment. Save the file on OneDrive, SharePoint, OneLake or storage account, get the link to the file and share the link in the email.
- What you already tried, use a notebook to send an email. But then you need to have a service principal to be able to connect to Microsoft Graph and send an email using the Graph API.
- Create a Power Automate Flow or Azure Logic App with a HTTP request trigger. From the Fabric pipeline use the Web activity with a POST request and pass the file content as part of the request body to be handled by he flow of your choice.
Hope this helps. If so, please give kudos 👍 and mark as Accepted Solution ✔️ to help others.