Share via

getSeries() does not work in Excel scripts

Anonymous
2024-04-24T13:25:44+00:00

Hi,

I got an issue with using the getSeries() function in excel script.

I want to write script to change the color of the pie chart. I did it manually and I recorded it.

The below is the code:

function main(workbook: ExcelScript.Workbook) {

let selectedSheet = workbook.getActiveWorksheet(); 

let TestingChart = selectedSheet.getChart("TestingChart"); 

// Set fill color on series for a chart 

TestingChart.getSeries()[0].getFormat().getFill().setSolidColor("#FF0000"); 

}

However, when I try to run it again. I got error "Chart getSeries: The requested resource doesn't exist."

the chart is a pie chart and I am pretty sure the chart contains some series on it.

Thank you.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-04-24T13:57:21+00:00

    I'd suggest you create a new thread in Office Development which is special channel to handle Office Script questions.

    Office Development - Microsoft Q&A

    Thank you for your understanding.

    Was this answer helpful?

    0 comments No comments