Link Search Menu Expand Document

XLS/XLSX to TXT

Convert XLS, XLSX or CSV into Text file.

Available methods

[POST] /xls/convert/to/txt

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching.
  • name optional. File name for generated output. Must be a String.
  • worksheetIndex optional. index of worksheet to use.
  • inline optional. Set to true to return resulted content in the response instead of link to results. Must be one of: true, false.
  • encrypt optional. Enable encryption for output file. Must be one of: true, false.
  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false.
  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/xls/convert/to/txt

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls"
}

Example responses

No example responses saved.

Code Snippets

CURL
curl --location --request POST 'https://api.pdf.co/v1/xls/convert/to/txt' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls"
}'
JavaScript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls"
});

var requestOptions = {
	method: 'POST',
	headers: myHeaders,
	body: raw,
	redirect: 'follow'
};

fetch("https://api.pdf.co/v1/xls/convert/to/txt", requestOptions)
	.then(response => response.text())
	.then(result => console.log(result))
	.catch(error => console.log('error', error));
NodeJs
var request = require('request');
var options = {
	'method': 'POST',
	'url': 'https://api.pdf.co/v1/xls/convert/to/txt',
	'headers': {
		'x-api-key': '',
		'Content-Type': 'application/json'
	},
	body: JSON.stringify({
	 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls"
	})

};
request(options, function (error, response) {
	if (error) throw new Error(error);
	console.log(response.body);
});

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
	CURLOPT_URL => 'https://api.pdf.co/v1/xls/convert/to/txt',
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_ENCODING => '',
	CURLOPT_MAXREDIRS => 10,
	CURLOPT_TIMEOUT => 0,
	CURLOPT_FOLLOWLOCATION => true,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => 'POST',
	CURLOPT_POSTFIELDS =>'{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls"
}',
	CURLOPT_HTTPHEADER => array(
		'x-api-key: ',
		'Content-Type: application/json'
	),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Java
import java.io.*;
import okhttp3.*;
public class main {
	public static void main(String []args) throws IOException{
		OkHttpClient client = new OkHttpClient().newBuilder()
			.build();
		MediaType mediaType = MediaType.parse("application/json");
		RequestBody body = RequestBody.create(mediaType, "{\n    \"url\": \"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls\"\n}");
		Request request = new Request.Builder()
			.url("https://api.pdf.co/v1/xls/convert/to/txt")
			.method("POST", body)
			.addHeader("x-api-key", "")
			.addHeader("Content-Type", "application/json")
			.build();
		Response response = client.newCall(request).execute();
		System.out.println(response.body().string());
	}
}

C#
using System;
using RestSharp;
namespace HelloWorldApplication {
	class HelloWorld {
		static void Main(string[] args) {
			var client = new RestClient("https://api.pdf.co/v1/xls/convert/to/txt");
			client.Timeout = -1;
			var request = new RestRequest(Method.POST);
			request.AddHeader("x-api-key", "");
			request.AddHeader("Content-Type", "application/json");
			var body = @"{" + "\n" +
			@"    ""url"": ""https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls""" + "\n" +
			@"}";
			request.AddParameter("application/json", body,  ParameterType.RequestBody);
			IRestResponse response = client.Execute(request);
			Console.WriteLine(response.Content);
		}
	}
}

Python
import requests
import json

url = "https://api.pdf.co/v1/xls/convert/to/txt"

payload = json.dumps({
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls"
})
headers = {
	'x-api-key': '',
	'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Powershell
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("x-api-key", "")
$headers.Add("Content-Type", "application/json")

$body = "{`n    `"url`": `"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls`"`n}"

$response = Invoke-RestMethod 'https://api.pdf.co/v1/xls/convert/to/txt' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json