Excel file with Chart Sheet as first sheet - Exception

Hello all!

I have an Excel file in which the first sheet of the Excel file is Chart Sheet. This special sheet does not contain rows, columns, or cells, just a chart, like this:

When trying to get the range from the associated table on the second sheet (named ā€œDadosā€), UiPath returns an Exception:

After many attempts to understand why this happens, I have discovered that if the first sheet of the Excel file is a Chart Sheet (with no columns, no rows, no cells) UIPath gives the error.
If I change the file, and move the Chart Sheet to be second in order, then UIPath can execute the ā€œGet Table Rangeā€ activity with no errors. So the problem here is when the first sheet is a special chart.

Does everybody has the same error behaviour?
(I am wondering if this is an issue of UIPath or my old Excel 2007).
If so, is it possible to change the order of the sheets in the Excel file?

I am attaching the Workflow and Excel file for you to simulate it.
ChartExcel.zip (15.1 KB)

Regards

2 Likes

I donā€™t get the error if I donā€™t use the application scope and when first sheet is a special chart.(not sure if it is programatically correct)

3 Likes

Hi @Thiago

Actually you are getting this error because your cast is wrong because you are using ā€œExcel Activity Scopeā€ with it.

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)

This interface only gives you worksheets - not charts.

Go to Remark section :slight_smile:

On the other hand, if you will use ā€œWorkbook Activitiesā€ so itā€™s instance _Workbook.Sheets gives you a Sheets instance.

Go to Remark section :slight_smile:

The interfaces are not assignable to each other; therefore, you are getting the COM error.

i have not yet tried so do not know itā€™s possible to get an instance of the Worksheets interface through the ā€œOffice Primary Interop Assembliesā€.

As long as you will use workbook activities i.e. _Workbook.Worksheets property instead of the _Workbook.Sheets property, you should get an instance of Sheets that only returns Worksheet objects for these charts objects etc. as i explained above.

ChartExcel.zip (15.0 KB)

Regardsā€¦!!
Aksh

7 Likes

Thanks @vvaidya and @aksh1yadav!

Using the Workbook Activites (without application scope) solves the problem. :clap:

1 Like

Hey @Thiago

Here this post is just for your update that now You will be able to use Excel file having chart as a sheet with Excel application scope and All Excel Related Activities..

I have tested it and it is working as per expectation :slight_smile:

Here are the Information about The Excel Activities package version in which this issue has been Fixed :slight_smile:

Hope this information will be useful for other users :slight_smile:

Package Version - 2.0.6479.13204

Published on - 10/08/2017
   
Issues has been Fixed with Excel Related, are as follows:slight_smile:  

1. Fix Excel Application activities failing if the workbook contained Charts 
2. Fix Workbook Get Table Range for Pivot tables throwing exception
3. Fix Workbook Read Range 'too many parameters' error
4. Fix Workbook Read Range 'Expression expected' error
5. Add Headers option for Read Range is set to true by default

Regardsā€¦!!
Aksh

4 Likes

Thanks @aksh1yadav for the Update!

2 Likes