How to convert PDF to XLSX from URL for PDF to excel API in PowerShell and PDF.co Web API

How to convert PDF to XLSX from URL for PDF to excel API in PowerShell: How To Tutorial

The documentation is designed to help you to implement the features on your side. PDF.co Web API helps with PDF to excel API in PowerShell. PDF.co Web API is the Rest API that provides set of data extraction functions, tools for documents manipulation, splitting and merging of pdf files. Includes built-in OCR, images recognition, can generate and read barcodes from images, scans and pdf.

PowerShell code samples for PowerShell developers help to speed up the application’s code writing when using PDF.co Web API. This PowerShell sample code should be copied and pasted into your project. After doing this just compile your project and click Run. You can use these PowerShell sample examples in one or many applications.

PDF.co Web API – free trial version is on available our website. Also, there are other code samples to help you with your PowerShell application included into trial version.

Try PDF.co Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

ConvertPdfToXlsxFromUrl.ps1
      
# The authentication key (API Key). # Get your own by registering at https://app.pdf.co/documentation/api $API_KEY = "***********************************" # Direct URL of source PDF file. $SourceFileUrl = "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-to-excel/sample.pdf" # Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'. $Pages = "" # PDF document password. Leave empty for unprotected documents. $Password = "" # Destination XLSX file name $DestinationFile = ".\result.xlsx" # Prepare URL for `PDF To XLSX` API call $query = "https://api.pdf.co/v1/pdf/convert/to/xlsx?name={0}&password={1}&pages={2}&url={3}" -f ` $(Split-Path $DestinationFile -Leaf), $Password, $Pages, $SourceFileUrl $query = [System.Uri]::EscapeUriString($query) try { # Execute request $jsonResponse = Invoke-RestMethod -Method Get -Headers @{ "x-api-key" = $API_KEY } -Uri $query if ($jsonResponse.error -eq $false) { # Get URL of generated XLSX file $resultFileUrl = $jsonResponse.url; # Download XLSX file Invoke-WebRequest -Headers @{ "x-api-key" = $API_KEY } -OutFile $DestinationFile -Uri $resultFileUrl Write-Host "Generated XLSX file saved as `"$($DestinationFile)`" file." } else { # Display service reported error Write-Host $jsonResponse.message } } catch { # Display request error Write-Host $_.Exception }

Try PDF.co Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

run.bat
      
@echo off powershell -NoProfile -ExecutionPolicy Bypass -Command "& .\ConvertPdfToXlsxFromUrl.ps1" echo Script finished with errorlevel=%errorlevel% pause

Try PDF.co Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Get PDF.co Web API Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Related Samples: