Extracting Chart/Images from Excel

Hi,
I am trying to save charts as images from an excel file. The current plan I was attempting was to save the excel as a web page which will generate a folder of resources where the charts will be included as an image and then get the chart from there. However, when I try to save the excel file as a webpage, the select item activity doesn’t actually activate the file type. The below image shows the “Web Page” type selected but the save as dialog is not registering this. Choosing to save like this will cause the file type to still be an excel.


The below image shows how it should look like if Web Page type is actually selected

Is there a solution for this? Or is there a better way to extract the charts from excel instead of saving it as a web page. Thanks.

@p3tr1fy

ExcelExtractChart.zip (18.9 KB)

  • in the Excel File, add the Macro to save the Chart to Image (image save as D:\mychart.png in the workflow) then assign keyboard shortcut for the Macro (CTRL-SHIFT-A)

  • at UiPath Studio use Click activity at the Excel Chart (to select the Chart) and activate the Macro (send HotKey) and process the image.

Save Excel Chart As Image macro tutorial:

Thanks. But my concern is how will UiPath reliably select a chart. For example, if UiPath is on another sheet or if the chart itself is not in view.

In the workflow, it first open Excel Application and continue with a click to the Chart.
This will make the Excel apllication in focus and the Chart selected.

1 Like

The reason your workflow works is because the chart is large enough and also within range of the click activity. If for example you were on sheet 2 of your excel, the bot will click nothing and fail the execution of macro.

1 Like

I have found another solution which is to use the select range activity for the chart and send hot key (ctrl + c) to excel and then paste into paint to save as image. This way it reduces the need for macro as I do not want to save the excel as macro enabled to be part of the automation process.

1 Like

Hi @p3tr1fy ,

Here is an activity is called “Extract Graph image” from BalaRevaEasyExcel .It extracts all the images from the sheet.

Regards
Balamurugan.S

1 Like

Hi @hermawan,

How can i copy or cut graphs from excel and paste in new sheet

Regards,
Balasubramanian

1 Like

Hi @BALASUBRAMANIAN,

You can use the above activity to get all the chart as image.

You can use the insert picture activity from below.

Regards
Balamurugan.S

Hi @balupad14,

I want as graph, not a image

Regards,
Balasubramanian

Hello @balupad14,

I am unable to extract the graph image.
Error: Extract Graph Image: Unable to cast COM object of type ‘Microsoft.Office.Interop.Excel.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Excel._Application’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D5-0000-0000-C000-000000000046}’ failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

Hi @tejastandel007,
Can you send me the sample excel file which you have used to extract the image ? If the excel file doesn’t have the cells , you can not extract the chart as image like below.

Regards
Balamurugan.S

Haii @ balupad14
if you don’t mind please share the demo video about " how to use Extract graph image activity"
thank you

1 Like

Hi @sowndaryacse1505,

Thank you for your interest.

Sure I will upload into my channel and share it here.

Thank you.
Balamurugan.S

Hi @sowndaryacse1505,

Check this video …

Regards
Balamurugan.S

1 Like

Thank you sir☺

1 Like

Use below activity if generating image separately can help https://connect.uipath.com/marketplace/components/chart-image-generator