---
title: "Converts a worksheet of spreadsheet on a local drive to the pdf file."
description: "This method reads a spreadsheet file from the local file system, converts it's worksheet to the desired pdf file, and returns the converted result. \nThe source file path and target format must be specified correctly. \nEnsure that the necessary permissions are in place to read the source file and write the converted file if applicable. \nThe conversion process occurs entirely on the cloud server, eliminating the need for any cloud storage or external downloads. \nIf the source file does not exist, is inaccessible, or if an error occurs during the conversion process, an appropriate exception will be thrown. \nSupported formats for conversion depend on the available libraries and their capabilities."

---

# Converts a worksheet of spreadsheet on a local drive to the pdf file.


> This method reads a spreadsheet file from the local file system, converts it's worksheet to the desired pdf file, and returns the converted result. \nThe source file path and target format must be specified correctly. \nEnsure that the necessary permissions are in place to read the source file and write the converted file if applicable. \nThe conversion process occurs entirely on the cloud server, eliminating the need for any cloud storage or external downloads. \nIf the source file does not exist, is inaccessible, or if an error occurs during the conversion process, an appropriate exception will be thrown. \nSupported formats for conversion depend on the available libraries and their capabilities.





















































# Convert Excel files to other formats
Aspose.Cells Cloud provides robust support for Excel file format conversion, a process known for its intricacy. Aspose.Cells Cloud supports 30+ file formats, including Excel, Pdf, Markdown, Json, XML, Csv, Html, and so on.
Supported Features : Aspose.Cells Cloud provides REST API which supports converting Excel files to various format and offers SDKs for multiple programming languages. These programming languages are include of Net, Java, Go, NodeJS, Python, and so on. .
.landguage-index-ferture{
margin-top:9px;
}
.landguage-index-ferture span{
font-weight:bold;
}
.panelContainer {
width: 100%;
}
.cells-cloud-input-group {
display: flex;
margin: 15px auto 0;
border: 1px solid #eee;
border-radius: 10px;
background-color: #ffffff;
align-items: center;
justify-content: space-between
}
.cells-cloud-input-group-main {
flex-grow: 1;
display: inline-block;
padding: 0 4px;
color: #333;
display: inline-block;
}
.cells-cloud-input-group-prepend {
display: inline-block;
height: 52px;
border-radius: 10px 0 0 10px;
padding: 0 20px;
background-color: #e3e3e8;
color: #333;
line-height: 50px
}
.cells-cloud-input-group-method {
float: left;
padding-right: 4px;
color: #ccc;
}
.cells-cloud-input-group-main {
display: inline-block
}
.cells-cloud-input-group-append {
float: right;
}
.cells-cloud-link-button {
display: inline-block;
border: 1px solid transparent;
border-left: 1px solid #e3e3e8;
border-radius: 10px 10px 10px 10px;
padding: 0 20px;
outline: none;
box-shadow: none;
background-color: #1a89d0;
text-align: center;
vertical-align: middle;
color: #151617;
line-height: 20px;
font-size: 1rem;
font-weight: 400;
}
.cells-api-text{
text-align: left;
vertical-align: middle;
color: #151617;
line-height: 50px;
font-size: 1rem;
margin: 0 auto;
width: fit-content;
font-weight: 400;
}
.cells-cloud-action-button {
display: inline-block;
width: 100%;
border: 1px solid transparent;
border-left: 1px solid #e3e3e8;
border-radius: 10px 10px 10px 10px;
padding: 0 20px;
outline: none;
box-shadow: none;
background-color: #1a89d0;
text-align: center;
vertical-align: middle;
color: #151617;
line-height: 50px;
font-size: 1rem;
margin: 0 auto;
width: fit-content;
font-weight: 400;
}
PUT
/cells/convert/worksheet/pdf
-->
.parametersname2{
display: inline-block;
font-size: 1.2rem;
font-weight: 400;
width: 33%;
height: 50px;
vertical-align: top;
line-height: 50px;
}
.upload-label{
background: #FFFFFF;
border: 1px solid rgba(152, 162, 178, 0.21)!important;
box-shadow: 0px 1px 3px rgba(96, 108, 128, 0.05)!important;
border-radius: 8px;
padding: 5px 10px!important;
height: 50px;
outline: none;
font-size: 14px;
width:100%;
display:inline-block;
cursor:pointer;
line-height:38px;
font-size: 15px;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.upload-file{
display:none !important;
}
.parameters-layout2{
display:block;
width:33%;float:left;
text-align:left;
}
.required{
color: red;
float: right;
}
Choose files
-->
.parametersname{
display: inline-block;
font-size: 1.2rem;
font-weight: 400;
height: 50px;
vertical-align: top;
line-height: 50px;
padding-left:5px;
}
.parameters-layout input{
background: #FFFFFF;
border: 1px solid rgba(152, 162, 178, 0.21)!important;
box-shadow: 0px 1px 3px rgba(96, 108, 128, 0.05)!important;
border-radius: 8px;
padding: 5px 10px!important;
height: 50px;
outline: none;
font-size: 14px;
width:calc(100% - 15px);
}
.parameters-layout{
display:inline-block;
width:33%;
float: left;
text-align:left;
margin-bottom:30px;
}
.required{
color: red;
float: right;
}
-->
Show all parameters
.sjds{
visibility: hidden;
visibility: visible;
}
#showparmeters{
width: 40%;
height: 50px;
background-color: #c1c1c1;
font-size: 20px;
font-weight: bold;
color: white;
text-align: center;
line-height: 50px;
border-radius: 10px;
cursor: pointer;
margin: 0 auto;
margin-bottom: 42px;
}
console.log( $(".parameters-layout"))
for (var i = 2; i -->
```
package com.aspose.cloud.cells.api;
import com.aspose.cloud.cells.api.CellsApi;
import com.aspose.cloud.cells.request.*;
public class Example {
public static void main(String[] args) {
try {
CellsApi api = new CellsApi(&#34;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#34;, &#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;);
ConvertWorksheetToPdfRequest request = new ConvertWorksheetToPdfRequest();
request.setSpreadsheet(&#34;EmployeeSalesSummary.xlsx&#34;);
request.setworksheet(&#34;Sheet1&#34;);
api.ConvertWorksheetToPdf(request);
} catch (ApiException e) {
e.printStackTrace();
}
}
}
```
#cellsconvert pre{
padding-left:10px;
padding-top:10px;
padding-bottom:10px;
margin-bottom:0px;
overflow:hidden;
}
function handleFileUpload(){
var fileInput = document.getElementById('convertupload');
var files = fileInput.files;
if (!files) return;
if (files.length === 1) {
var file = files[0];
var filename = file.name;
$(".upload-label").html(filename);
var codePreview = $("#cellsconvert code").text().trim();
codePreview = codePreview
.replace(/Spreadsheet = ".*?"/, `Spreadsheet = "${filename}"`)
$("#cellsconvert code").text(codePreview);
}else{
var fileNames = Array.from(files).map(file => file.name).join(', ');
$(".upload-label").html(fileNames);
var dictCode = 'var spreadsheets = new Dictionary\n {\n';
Array.from(files).forEach((file, index) => {
var fileName = file.name;
dictCode += ` { "${fileName}", File.OpenRead("path/to/${fileName}") }`;
if (index ')) {
codePreview = codePreview.replace(
/var spreadsheets = new Dictionary.*?};/s,
dictCode
);
}
$("#cellsconvert code").text(codePreview);
}
}
$('input[name="format"]').on('input', function() {
const format = $(this).val().trim().toLowerCase() || "pdf";
var codePreview = $("#cellsconvert code").text().trim();;
codePreview = codePreview
.replace(/format = ".*?"/,`format = "${format}"`)
.replace(/"result\..*?"/,`"result.${format}"`);
$("#cellsconvert code").text(codePreview);
});
$('input[name="outFormat"]').on('input', function() {
const format = $(this).val().trim().toLowerCase() || "pdf";
var codePreview = $("#cellsconvert code").text().trim();;
codePreview = codePreview
.replace(/outFormat = ".*?"/,`outFormat = "${format}"`)
.replace(/"result\..*?"/,`"result.${format}"`);
$("#cellsconvert code").text(codePreview);
});
$("#copycode").click(function() {
var textarea = document.createElement('textarea');
textarea.value = $("#cellsconvert code").text()
document.body.appendChild(textarea);
textarea.select();
var success = document.execCommand('copy');
document.body.removeChild(textarea);
});
Go to Api reference
Run Code
function createMessageElement(elementType, className, innerHTML,id) {
var element = document.createElement(elementType);
element.className = className;
element.innerHTML = innerHTML;
element.id = id;
return element;
}
$('[name="RunCode"]').click(async function() {
const fileInput = $('#convertupload')[0];
const selectedFile = fileInput.files[0];
if (!selectedFile) {
alert("Please select a file first!");
return;
}
const format = $('[name="format"]').val().trim().toUpperCase();
if (!format) {
alert("Please enter a target format!");
return;
}
try {
const formData = new FormData();
formData.append("url", "https://api.aspose.cloud/v4.0/cells/convert/spreadsheet?format=" + format);
formData.append("method", "PUT");
formData.append("files", selectedFile);
const response = await fetch('https://cells-scripting-api.aspose.cloud/v4.0/cells/runwebapi', {
method: 'POST',
body: formData,
});
if (!response.ok) {
throw new Error(`Conversion failed: ${await response.text()}`);
}
const blob = await response.blob();
const downloadUrl = URL.createObjectURL(blob);
console.log(response);
console.log(downloadUrl)
var messageElement3 = createMessageElement("button", "api-button", "", "downloadshow");
messageElement3.innerHTML = `[Download](${downloadUrl})`;
$("#test1").append(messageElement3);
} catch (error) {
console.error("Error:", error);
alert("An error occurred during conversion.");
}
});
.loadingmask{
position: fixed;
width: 100%;
height: 100%;
background: black;
z-index: 9999;
top: 0px;
left: 0px;
top: 60px;
opacity: 0.3;
display:none;
}
.api-button{
height: 40px;
border-radius: 10px;
background:#979797;
color: white !important;
border: none;
cursor: pointer;
font-size: 17px !important;
outline: none !important;
padding-left: 10px;
padding-right: 10px;
margin-right: 14px !important;
}
.api-button:hover{
background:#4C4C4C;
}
#test1{
text-align: left;
margin-bottom: 15px;
background-color: #c1c1c1;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 10px !important;
border-radius: 0 0 10px 10px;
}
-->
Available SDKs
The Aspose.Cells Cloud SDK is available in multiple popular programming languages, enabling developers to integrate spreadsheet processing capabilities across various development environments.
GO
GO : ASPOSECELLSCLOUD
JAVA
MAVEN : ASPOSE.CELLS.CLOUD.POM.XML
.NET
NUGET : ASPOSE.CELLS-CLOUD
NODE.JS
NPM : ASPOSECELLSCLOUD
PERL
CPAN : ASPOSECELLSCLOUD-CELLSAPI
PHP
COMPOSER : ASPOSE/CELLS-SDK-PHP
PYTHON
PIP : ASPOSECELLSCLOUD
RUBY
GEM : ASPOSE_CELLS_CLOUD
.huizhang{
padding: 9px !important;
color: white !important;
margin-top: 25px !important;
display: inline-block !important;
width: 75% !important;
text-align: center !important;
border-radius: 5px !important;
}
.huizhang2{
padding: 9px !important;
color: white !important;
margin-top: 25px !important;
display: inline-block !important;
width: 19% !important;
text-align: center !important;
border-radius: 5px !important;
}
Resource Links
Cells Cloud Documentation
Cells Cloud API References
Cells Cloud Free Support
Cells Cloud Blog
Get Started for Free
Pricing Information
.huizhang{
padding: 9px !important;
color: white !important;
margin-top: 25px !important;
display: inline-block !important;
width: 75% !important;
text-align: center !important;
border-radius: 5px !important;
}
.huizhang2{
padding: 9px !important;
color: white !important;
margin-top: 25px !important;
display: inline-block !important;
width: 19% !important;
text-align: center !important;
border-radius: 5px !important;
}



