This article will demonstrate how to rename an Excel Worksheet with the WorksheetsApi interface offered by Spire.Cloud.Excel API.
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class renameWorksheet {
static String appId = "APP ID";
static String appKey = "APP Key";
static String baseUrl = "https://api.cloudxdocs.com";
//Create a Configuration object based on App ID, App Key and base Url
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
//Create an instance of WorksheetsApi
static WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
//Specify the name of the test Excel document
String name = "test.xlsx";
//Specify the folder where the test document is stored, set it to null if there's none
String folder = "input";
//Store the document in the 2G default storage space offered by E-iceblue Cloud
String storage = null;
//Rename the second worksheet with the "renameWorksheet" method
String sheetName = "Sheet2";
String newName = "Data";
WorksheetsApi.renameWorksheet(name, sheetName, newName, folder, storage);
}
}