Copy data from Excel and pasting same in outlook


#1

Hi Team,

I have one excel with multiple tables and chart diagrams. I want to select range of cells (which are referring to one table) and charts and insert them in outlook to be sent as a notification to participants. please help me on how to approach this.


#2

Hi,

You can use excel recorder and outlook activity to achieve your use case

Regards,
Amit


#3

Hi Amit,

Thanks for your response, but as I am new to using the tool, it would be helpful if you can elaborate a little. I have tried using excel recorder to copy the values but not able to paste the content in mail post that. Please elaborate on steps.


#4

Hi,

You just copy the value while recording. The value will be stored in a argument. You can verify the value by using a write line activity post excel recorder.

Post that you can add outlook activity and use Send mail feature o send mail along with your data


#5

Hi Amit,

As suggested by you, first I did excel recording and then checked the argument. three arguments were created:

  1. rangeArg1 where excel range is mentioned which has to be copied
  2. fileArg1 which has the path of the excel
  3. copyExcelArg1 which is of direction Out, without any default value.

When I tried to write all 3 arguments, i am getting correct range and path, but copy argument is returning System.Object[,] instead of actual data which was there for selected range.

One more query, when I am copying a chart from the excel, no out direction argument is created. Dont know how to achieve same.

Also, if I want to place argument rangeArg1 in the mail body, how to call same. I tried creating a new argument for mail content and typed the tet as “Range for automation is” rangeArg1, same was not accepted. I want to call multiple arguments in the mail content such that mail content is automatically updated based on these values.

Please suggest what mistake I am doing.


#7

Hi,

If you copy a ranhe of cells then you will get an object. If you will copy a single cell you will get a string argument

In case you want to get three values then copy each cell one by one so that you get 3 output arguments each having value of separate cells.
A chart is in image and will have no string value


#8

Hi Amit,

Thank you for your response, but I need to copt data in tabular format and then include that in mail. If I copy cells one by one, it will not have the tabular format while including same in mail. Hence please help on how can I call this created object (range of cells.)


#9

From excel it is not possible to data in tabular format. Copy data cell by cell and in your mail body form an html table with cell values.

Regards,
Amit


#10

Dear User,

Try following below steps to achieve copy paste image from Excel to Outlook-

  1. Make sure your last action in Excel Macro Recording as Copy of Chart. This will save Chart to clipboard
  2. Use Windows Automation to automate outlook to send email
  3. Use Send Key activity (with keys configured as “Ctrl” + “V”) to paste chart in drafted email.

Thanks,
Sachin