Running Excel Scripts on Outlook Attachments then sending processed files - power-automate

TL;DR: I want to extract an Excel attachment from an Outlook message, automate an Excel script on the unprocessed reports, and then send the output in a new email message.
I have reports from Amazon that I have sent to a specific email on my Outlook folder each month.
I set up Power Automate to trigger whenever an email with an attachment is received in this folder.
I want to take the attachment in this Outlook email and run an Excel script that I build on Excel Desktop (not an Excel application macro) to format the data.
And then I want to send the output/result (scripted email attachment) as the body of an email out to clients.
I've gotten the first and last parts to run, but I can't get the script to process the file, that's the phase that always breaks that automation.
Things that I think might be causing the issue:
Do I need to extract the attachment from the email and save it as a file before I can run the Excel script on it?
Does the attachment need to be saved through Share Point to be later referenced by the Excel script?
Does the script need to be on the same or different cards as previous steps?
I've seen people run the Excel script through a Scope.
I've also looked at every available YouTube video to troubleshoot this: some go over certain steps in the process, but I'm having a hard time threading everything together.
Other Things I've Tried
I also tried to build a macro that does the same thing as my Excel desktop automation, and then wrote VBA code so each time a new sheet is opened the same macro is run, processing the data. But I couldn't get it to run on any new future sheet that I open, even when writing the VBA auto-open code in Module as well as This Worksheet.
I'm open to any method that will make this work.

Get email (V2) - Message ID
#{triggerOutputs()?['body/id']}
Apply to Each - Select an output from previous steps
#{outputs('Get_email_(V2)')?['body/attachments']}
Create File - File Name
#{items('Apply_to_each')?['name']}
Create File - File Content
#{items('Apply_to_each')?['contentBytes']}
Move or rename a file - File (make sure you add .xlsx for Destination File Path)
#outputs('Create_file')?['body/Id']
Run Script - File
#outputs('Move_or_rename_a_file')?['body/Id']
Get file content - File
#outputs('Move_or_rename_a_file')?['body/Id']
Send an email (V2) - Attachments Name-1
#outputs('Move_or_rename_a_file')?['body/DisplayName']
Send an email (V2) - Attachments Content - 1
#body('Get_file_content')?['body']

Related

Power Automate: Send eMail mit Sharepoint attachement

I have a problem creating a flow. All files for the flow are in a sharepoint. In an Excel list, I call up various information such as name, surname, e-mail and also the file name of the e-mail attachment. The e-mail attachment is also stored on the Sharepoint in a different underlying folder. How do I include the attachment in the flow?
The whole flow works fine. However, when I let the attach file be selected dynamically like,
the flow runs into an error:
Without a dynamic attachment (hard coded) it runs through without error:
Here the eMail result - hard coded attachement:
Any idea how to select the attachment dynamicaly?
Thank you very much for your help.
Kind regards
Andi
You'll want to use this specific action ...
... there are two and the one I have shown is the one you'll need to use.

How to check if a csv file has been uploaded in a drive daily and alert user if not?

I have been assigned a task of automating a manual activity which involves checking if a particular data file has been uploaded in a drive daily.The file is a .csv file added incrementally(once) every morning and named based on the date and time it has been uploaded.
In case the file is not present in the drive folder there should be a trigger alert to the stakeholders in the form of email.
What are the automation tools I can use to automate this particular activity?
My current plan is to write a java code that checks the folder.Using Jenkins I will run it everyday and trigger email alert in case a particular file is not present.
Is there any easier way to do this?

How can I create a Slack command with a file attachment

I would like to create a Slack command /command do-something-with-that-file with at the same time, the user uploading the file.
So far, my command is received but there is no files in the payload.
Is this possible?
I have also added files:read in the scope but no luck so far.
A Slack command can only accept text as input. If you upload a file at the same time, it wouldn't be a part of the payload and will be ignored (although uploaded, and accessible through file browser).
Some alternatives you could try though:
Use files.list method - Look for files uploaded within a few seconds of the moment when you receive the command. The method accepts ts_from and ts_to parameters for this purpose.
Use file_shared event - Subscribe to this event in your app configuration. This event fires every time a file is uploaded in a channel visible to your bot. You could ask the app user to use a certain format to provide with a file upload, and look for a pattern in the event submission.
Use message shortcut - Once a user uploads a file, you can ask them to use the context menu to fire a message shortcut associated with your app. This message shortcut contains a reference to the message ID, which can be used to fetch the uploaded file.

Attaching File To Microsoft Outlook with AppleScript

I am trying to make a script that will attach a file to Outlook and then send it. I have that part of the script down fine. My only problem is that for some reason the file isn't attaching. When I look at the replies box at the bottom, it says that it attached and sent the email successfully, however, the file is not attached. What is wrong with my script?
tell write_email
delay 1
make new attachment with properties {file:fileAttachment}
delay 1
end tell
send write_email
I already defined prior to that bit of code this:
set fileAttachment to /Desktop/file-name

Automatically adding attachments to all outgoing mail messages

A two-part newbie question, guys... I've only just discovered AppleScript and I'm hoping to automagically attach a 'pdf' file to every outgoing (sent) "Mail.app" message.
(Q1) I've got it working successfully in tests running direct from Script Editor - with the file located in the Documents folder - and I'm using:
set pdfFile_Path to ((path to documents folder as text) & "paginatedPDF.pdf")
but the filepath bit confuses me... How would I change this line if I wanted to store my file inside a folder called "PDF's to send" on my desktop?
(Q2) How can I attach the script as a Mail.app rule (the rule options only seem to offer incoming mail message conditions, not outgoing ones)?
Any help/advice much appreciated. Thanks :-)
Have you tried dragging and dropping the PDF straight into your Signature?

Resources