How to Select Random Pages of Excel to Make a PDF using PDF.co Web API
In this tutorial, we will show you how to select random pages of Excel to make a PDF using PDF.co Web API.
We will use this sample Excel document with 3 worksheets in this tutorial.
![Sample Excel Document](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F27da0b466d53d6ddbde42fc3fdd49c2f0538bb65-1178x882.png&w=3840&q=75)
Step 1: Log in to PDF.co Account
- To begin. First, log into your PDF.co account and click on the Request Tester menu.
![Request Tester](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F1da31f368621a4201c90e89b1dba488323b75c04-2494x1414.png&w=3840&q=75)
Step 2: Request Tester Page
- Once you’re on the Request Tester page, select
/xls/convert/to/pdf
the Choose PDF.co API endpoint field. This endpoint will convert the Excel file to PDF. - For the Input parameters field, add your source file with a link or input with a file.
- Then, enter the sample JSON code. The worksheet index parameter will allow you to specify which specific sheets you want to convert to PDF. The worksheet index starts at
“0”
sheet 1 and the worksheet index“1”
represents sheet 2.
![Request Tester Page](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Ff0b460178935b3ba9f8a9317177e7c876577e200-999x547.png&w=2048&q=75)
Once you are done setting up, click on the Run Request button to see the result.
Step 3: Run Request Result
- Great! The PDF.co successfully process our request. You can copy and paste the URL to view the output.
![Run Request Result](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F69680474a49a45907818387a3a2bf5e47223ae55-999x154.png&w=2048&q=75)
Step 4: Generated PDF Output
- Here’s the generated PDF output from selected Excel pages or worksheets.
![Generated PDF Output](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Fb14971001fcf8a119bf2a18439448608d3d83db5-999x596.png&w=2048&q=75)
In this tutorial, you learned how to select random pages of Excel to make a PDF using PDF.co Web API. You also learned how to use the /v1/xls/convert/to/pdf
endpoint to convert XLS to PDF format.
This is just one of the examples of the PDF.co Web API’s functionality. You can do a lot more, such as generating PDFs using Airtable linked records, merging or splitting PDF files, and many others.