Is there any usable way to copy Microsoft Excel sheets using the Graph API only?

Juan Jimmy 0 Reputation points
2025-01-30T03:44:09.9133333+00:00

Scenario

I am developing an RPA integration application that automates several services, including Microsoft services via their APIs (specifically Microsoft Graph). I want to copy sheets in Microsoft Excel, but the Graph API does not fully support this feature as anticipated.

Current Approach

Currently, I am using the Get Used Range API, which retrieves only the data without including styling (fonts, borders, colors, etc.). To work around this, I am iterating over the cells to copy each cell's styling:

for row in rows:
    for col in cols:
        font_cell = requests.get(font_link_source, headers=headers)
        requests.patch(font_link_target, headers=headers, json=font_cell)

This process is extremely slow; copying the fonts for every cell takes around 10 minutes.

Question

Is there any API available that could simplify this issue? Thank you for the assistance!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,919 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,126 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,200 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Akhil Nasalwai - MSFT 170 Reputation points Microsoft Vendor
    2025-01-30T17:01:49.47+00:00

    Hello Juan Jimmy,

    Thank you for reaching out to Microsoft!!

    For the query if there is any available API that could simplify the issue of copying the fonts very slowly,

    Unfortunately, there is no Graph API as there is only a single way that is already being used. You can submit this feature request using the link mentioned below, which will be monitored by Microsoft team and make the enhancements to Graph API.

    Link: support link

    As an alternative or workaround, you can prefer using the Excel Java Script APIs from the Office Dev samples as mentioned in the below link. It offers a method called Range.copyForm that can copy both data and formatting in a single operation.

    Link: Copy Cells

    Hope this helps.

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

    1 person found this answer helpful.

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.