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 ,
Thank you for reaching out to the Microsoft Community Forum.
Hi spaceman127 , nielsvdc and spencer_sa , Thank you for your prompt responses.
Hi dyordanov , could you please try the proposed solutions shared by spaceman127 and nielsvdc ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.
Regards,
Dinesh
So thanks for all answers as of now, so the file i am about the send is about 15mb each. After I send it another notebook will calculate things based on the file I sent and the excel is about 50 mb. So would that change any of the workflow ?
- spaceman1278 months agoSuper User
Hi dyordanov,
What spencer_sa writes is another good option, or you can use the Logic App variant I described to you. Have you checked it out?
Best regards
- spencer_sa8 months agoImpactful Individual
One alternative if you're not too set on actually emailing a csv (and is better for large files) is to write the CSV file to an ADLS Gen II container, build an SAS token/link for it, and email that link to your recipient. You can then apply an expiry date if you need to and all you're emailing is a a URL so won't hit any size limits.
I have tested this and it works exactly as promised - Copy Activity to upload, notebook to generate the SAS token/URL, and an Email activity to send the email.