Create spreadsheets & documents with Java
Create a shareable spreadsheet from Java using the built-in java.net.http.HttpClient (Java 11+) — no Apache POI, no Google API. Send your rows as JSON and read the URL back. Works in plain Java, Spring Boot services, and Android backends.
import java.net.URI;
import java.net.http.*;
var json = """
{
"title": "Q3 Revenue",
"sheets": [{ "rows": [
["Month", "Revenue", "Growth"],
["July", 48200, "+12%"]
] }]
}
""";
var req = HttpRequest.newBuilder()
.uri(URI.create("https://openofficeai.com/api/v1/sheets"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var res = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body()); // contains the "url"How to create a spreadsheet with Java
- 1Copy your API key from the dashboard.
- 2Build an HttpRequest with the JSON body and Bearer header.
- 3Send it with HttpClient and read the response body.
- 4Parse the JSON (Jackson/Gson) to extract the url field.
Why use OpenOfficeAI with Java
- Built-in HttpClient — no Apache POI or external HTTP library.
- Drops into Spring Boot services and scheduled tasks.
- Generate invoices/reports without bundling a spreadsheet engine.
Frequently asked questions
Do I need Apache POI to make Excel files?
No. You send JSON and the API builds the workbook. For an .xlsx, call /api/v1/download/{id}?format=xlsx and write the bytes — no POI dependency or its memory overhead.
How do I parse the response in Spring Boot?
Use RestTemplate or WebClient and bind the response to a record/POJO with a url field, or read it as a JsonNode. WebClient is a clean fit for the single POST then read-url pattern.
Is this thread-safe for high volume?
Yes. Reuse a single HttpClient instance across threads — it is designed to be shared. Add a request timeout and handle non-201 responses by reading the JSON error body.
Start creating documents with Java
Free tier includes 500 API calls per month — no card required.