Why won't ChartSeries.getPoints() work in Excel for web?

Austin 0 Reputation points
2024-12-20T21:41:18.6666667+00:00

I have a workbook I've created in Excel for web with just a single column chart and some sample data to its side

User's image

Using office scripts, I'm trying to set the color of an individual column on the chart with this code:

function main(workbook: ExcelScript.Workbook) {

    const sheet = workbook.getWorksheet("Sheet1")
    const chart = sheet.getChart("Chart 1")
    const series = chart.getSeries()[0]

    const i = 3
    const point = series.getPoints()[i]
    point.getFormat().getFill().setSolidColor("red")
}

When I run this in Excel for web, I get the error ChartSeries getPoints: There was an internal error while processing the request.

But if I save this workbook locally and run this script on my desktop Excel, it works as expected. How can I make this code run in Excel for web?

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
5,371 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,048 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,103 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiajing Hua-MFST 12,240 Reputation points Microsoft Vendor
    2024-12-23T07:57:20.1366667+00:00

    Hi @Austin

    Questions about TypeScript development in general, you may also post in: https://stackoverflow.com/questions/tagged/office-scripts


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.