This tutorial guides on how to delete chart in Excel using Python REST API. You will learn to automatically remove chart from Excel using Python Low Code API with a Python-based Cloud SDK. It will also explain the overloaded functions for deleting the graphs.
Prerequisite
- Create an account and get API credentials for deleting a chart
- Download Aspose.Cells Cloud SDK for Python to remmove a graph
- Setup Python project with the above SDK
Steps to Delete Excel Chart using Python RESTful Service
- Set up your client credentials by providing the client ID, client secret, and the base URL of the Aspose Cloud service
- Create an instance of the CellsApi class using the credentials that act as the main interface
- Identify the Excel file (charts.xlsx) located on the local system that will be uploaded to the cloud for processing
- Construct and execute an upload request to transfer the local Excel file to Aspose Cloud
- Set up the parameters for deleting a chart, including the worksheet name and the index of the chart to be removed
- Call the Aspose.Cells API to remove the specified chart from the uploaded Excel file stored in the cloud
- Download the updated Excel file from the cloud after the chart has been deleted, and save it locally with a new file name
These steps summarize how to delete Excel chart using Python REST API. The code authenticates with Aspose.Cells Cloud, uploads a local Excel file, deletes a specified chart from a worksheet, and then downloads the updated file. It handles all operations i.e. uploading, chart removal, and file saving, while managing exceptions to ensure smooth execution.
Code to Delete Graph in Excel using Python-based API
This sample code has demonstrated how to delete chart in Excel using Python REST API. For deleting all the charts from a Worksheet, try the DeleteWorksheetCharts() method. It requires workbook name and sheet name for deleting all the charts from the uploaded Excel file.
This article has taught us the process to remove chars from the Workbook. To add a bar chart in an Excel file, refer to the article on Create Bar Chart in Excel using Python REST API.