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.
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.
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.
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.
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.
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.