PDF to Excel API
Category: ai
Extract tabular data from PDFs and convert to CSV format using AI.
Endpoint
POST
https://anythingtext.com/api/tools/pdf2excel
Authentication Required
Content-Type: multipart/form-data
Authentication
This API requires an API key. Generate one from the API Keys section in your dashboard settings.
Include the X-API-Key header in all API requests:
X-API-Key: atk_your_api_key_here
Rate Limiting
API requests are limited to 60 requests per minute per user. If you exceed this limit, the API returns a 429 Too Many Requests response.
Every response includes rate limit headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 42
When rate limited, the response body contains:
{ "error": "Rate limit exceeded. Maximum 60 requests per minute.", "retryAfter": 42, "limit": 60 }
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file
|
File | Required |
PDF file with tables
Example: report.pdf
|
Response
Content-Type: application/json
Extracted CSV data
{
"csv": "col1,col2\nval1,val2"
}
Error Responses
| Status | Description | Body |
|---|---|---|
401 |
Not authenticated | {"error": "Please log in..."} |
400 |
Bad request / Missing required params | {"error": "... is required"} |
500 |
Internal server error | {"error": "Failed to ..."} |
cURL Example
curl -X POST https://anythingtext.com/api/tools/pdf2excel \ -H "X-API-Key: your_api_key_here" \ -F "file=@report.pdf"
Code Samples
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch('https://anythingtext.com/api/tools/pdf2excel', {
method: 'POST',
headers: { 'X-API-Key': 'your_api_key_here' },
body: formData
});
const data = await response.json();
console.log('Result:', data);
import requests
with open('input_file', 'rb') as f:
response = requests.post(
'https://anythingtext.com/api/tools/pdf2excel',
files={'file': f},
headers={'X-API-Key': 'your_api_key_here'}
)
data = response.json()
print('Result:', data)
import java.net.URI;
import java.net.http.*;
import java.nio.file.*;
HttpClient client = HttpClient.newHttpClient();
String boundary = "----Boundary" + System.currentTimeMillis();
byte[] fileBytes = Files.readAllBytes(Path.of("input_file"));
String body = "--" + boundary + "\r\n"
+ "Content-Disposition: form-data; name=\"file\"; filename=\"input_file\"\r\n"
+ "Content-Type: application/octet-stream\r\n\r\n";
String end = "\r\n--" + boundary + "--";
byte[] prefix = body.getBytes();
byte[] suffix = end.getBytes();
byte[] full = new byte[prefix.length + fileBytes.length + suffix.length];
System.arraycopy(prefix, 0, full, 0, prefix.length);
System.arraycopy(fileBytes, 0, full, prefix.length, fileBytes.length);
System.arraycopy(suffix, 0, full, prefix.length + fileBytes.length, suffix.length);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://anythingtext.com/api/tools/pdf2excel"))
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
.header("X-API-Key", "your_api_key_here")
.POST(HttpRequest.BodyPublishers.ofByteArray(full))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println("Response: " + response.body());