This tutorial guides on how to create bar chart in Excel using Java REST API. You will learn to automatically make a bar chart in Excel using Java REST API with a Java-based Cloud SDK. Various options are discussed to customize the newly added chart.
Prerequisite
- Create an account and get API credentials for adding a bar chart
- Download Aspose.Cells Cloud SDK for Java to create a column graph
- Setup Java project with the above SDK
Steps to Create a Bar Graph in Excel using Java REST API
- Set up the client ID, client secret, and base URL required to authenticate with the Aspose.Cells Cloud API and Instantiate the CellsApi object
- Create a UploadFileRequest to send the Excel file to Aspose Cloud storage using the local Excel file
- Use the API client to upload the specified file to Cloud storage
- Set up a PutWorksheetChartRequest to define chart properties such as type, size, placement, sheet name, data range, and orientation
- Call the PutWorksheetChart() method to add the specified chart to the Excel worksheet in the cloud
- Use a DownloadFileRequest to retrieve the modified Excel file from cloud storage
- Write the downloaded file to the local file system as output.xlsx
These steps summarize how to create a barchart in Excel using Java RESTful Service. First, authenticate with Aspose.Cells Cloud using your client credentials, upload the Excel file, and configure the chart’s type, position, and data range. Then, insert the chart into the worksheet using the API and download the updated file to your local system.
Code to Make a Bar Graph in Excel using Java Low Code API
This sample code has demonstrated how to make Excel bar chart using Java REST Interface. You can make the chart more informative by setting a title and axis labels. It also supports the enhancement of readability by adding legends and showing values on bars.
This article has taught us the process of how to make a bar chart in Excel using Java REST API. For creating a Pie chart, refer to the article on Create an Excel Chart using Java REST API.