How to create a new Excel XLSX spreadsheet from column and row data in Java

Today’s problem is the creation of a new Excel file using row and column data. We shall solve this quickly with the help of an API.

Let’s get the ball rolling by using Jitpack to dynamically compile our library using these two references in our Maven POM file.





With our library ready, we are able to invoke editDocumentXlsxCreateSpreadsheetFromData:

// Import classes://import com.cloudmersive.client.invoker.ApiClient;//import com.cloudmersive.client.invoker.ApiException;//import com.cloudmersive.client.invoker.Configuration;//import com.cloudmersive.client.invoker.auth.*;//import com.cloudmersive.client.EditDocumentApi;ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");Apikey.setApiKey("YOUR API KEY");// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.setApiKeyPrefix("Token");EditDocumentApi apiInstance = new EditDocumentApi();CreateSpreadsheetFromDataRequest input = new CreateSpreadsheetFromDataRequest(); // CreateSpreadsheetFromDataRequest | Document input requesttry {CreateSpreadsheetFromDataResponse result = apiInstance.editDocumentXlsxCreateSpreadsheetFromData(input);System.out.println(result);} catch (ApiException e) {System.err.println("Exception when calling EditDocumentApi#editDocumentXlsxCreateSpreadsheetFromData");e.printStackTrace();}

And we can input our specifications like so:

"WorksheetName": "string",
"Rows": [
"Path": "string",
"Cells": [
"Path": "string",
"TextValue": "string",
"CellIdentifier": "string",
"StyleIndex": 0,
"Formula": "string"


Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store