Site icon Winhelponline

How to Batch Convert Excel Sheets into PDF Files

Microsoft Excel Spreadsheets are commonly used to store financial data and prepare invoices. Often, you may need to convert the .xls or .xlsx files to .pdf format especially if you’re sending out invoices to your clients.

Microsoft Excel has a built-in option using which you can save your workbook, active sheet, or selected cells to a PDF file. This can be accomplished using the Save as… dropdown box.

By clicking on the More options… link, you can configure the page range, and the item to export (entire workbook, active sheet, etc) to PDF.

Another option would be to use the Microsoft Print to PDF driver in Windows 10 to output the .xls or .xlsx file to a .pdf document. For this, you’d use the Print option (instead of Save as) to print the document to PDF.

Pre-Windows 10 systems don’t have the Microsoft Print to PDF driver. As an alternative. you can use the free CutePDF Writer or Foxit PDF Printer (part of Foxit PDF Reader software.)

Bulk conversion of Excel sheets to PDF

However, if you have hundreds of invoices (in .xls or .xlsx format) that you need to batch/bulk convert the files into PDF, the above options are not ideal and take a long time.

Fortunately, Microsoft Word and Microsoft Excel lets you automate the above task using scripting. This article tells you how to batch convert multiple Excel sheets into PDF files quickly.

How to Batch Convert Excel Sheets into PDF Files

Important: Before proceeding to any method below, please note that you’ll need to have Excel/Office installed and activated in your computer to convert the Excel sheet(s) to PDF.

Method 1: Using a custom VBScript

As said earlier, Microsoft Office has automation or scripting support. Using a VBScript, you can bulk convert Excel sheets to PDF quickly. Here is a simple script I wrote to do the job:

 'Convert .xls or .xlsx to .pdf files via Send To menu
Set fso = CreateObject("Scripting.FileSystemObject")
For i= 0 To WScript.Arguments.Count -1
   docPath = WScript.Arguments(i)
   docPath = fso.GetAbsolutePathName(docPath)
   If LCase(Right(docPath, 4)) = ".xls" Or LCase(Right(docPath, 5)) = ".xlsx" Then
      Set objExcel = CreateObject("Excel.Application") 
      pdfPath = fso.GetParentFolderName(docPath) & "\" & _
      fso.GetBaseName(docpath) & ".pdf"
      Set objWorkbook = objExcel.Workbooks.Open(docPath)
      objWorkbook.ExportAsFixedFormat 0, pdfPath, 0, True, False, , , False
      objWorkbook.Close False
      objExcel.Quit   
   End If   
Next

Note: The above script exports the entire workbook (all sheets). Also, it ignores cells that are outside of the print area (in case you’ve set the print area for your sheets before). You can customize the output options by modifying the ExportAsFixedFormat command in line #12 of the above script as you wish.

Convert Excel sheets to PDF using VBScript

  1. Copy the above VBScript code to Notepad.
  2. Save the file with a .vbs extension, and in a permanent folder. — e.g., d:\scripts\xls2pdf.vbs
  3. Close Notepad.
  4. Open File Explorer and browse the following SendTo folder:
    C:\Users\%username%\AppData\Roaming\Microsoft\Windows\SendTo
  5. Create a shortcut to the script xls2pdf.vbs in the SendTo folder.
  6. Prefix the shortcut target with wscript.exe and then followed by a space.
  7. Optionally, assign a nice-looking icon by clicking on the Change Icon button.
  8. Name the shortcut accordingly — e.g., Convert Excel Sheets to PDF
  9. Now, open the folder that contains the Excel sheets that you want to convert to PDF.
  10. Select the files, right-click on the selection, and click Send to.
  11. Click Convert Excel Sheets to PDF in the Send to menu.

    That’s it! Your PDF files are now ready!

Method 2: Using File Converter (Freeware)

File Converter is a simple tool that allows you to convert or compress one or several files using the context menu in Explorer. This program is Freeware! You can download it from the following link:

https://www.file-converter.org
https://github.com/Tichau/FileConverter

After you install the software, all you need to do is select the .xls or .xlsx files you want to convert, click File Converter in the right-click menu and select To Pdf.

You’ll see the progress bar for each file, as seen below:

Note: We’ve covered the excellent File Converter software earlier on this website.

File Converter – Command-line

To convert a .xls or .xlsx file to .pdf using command-line using File Converter, use this syntax:

"C:\Program Files\File Converter\FileConverter.exe" --conversion-preset "To Pdf" "drive:\path\filename.xlsx"

Here is the list of the input and output formats supported by File Converter.

Supported output formats Compatible input formats
Audio flac, aac, ogg, mp3, wav 3gp, aiff, ape, avi, bik, cda, flac, flv, m4a, mkv, mov, mp3, mp4, oga, ogg, wav, webm, wma, wmv
Video webm, mkv, mp4, ogv, avi, gif 3gp, avi, bik, flv, gif, m4v, mkv, mp4, mpeg, mov, ogv, webm, wmv
Image png, jpg, ico, webp bmp, exr, ico, jpg, jpeg, png, psd, svg, tiff, tga, webp, pdf, doc*, docx*, odt*, odp*, ods*, ppt*, pptx*, xls*,
xlsx*
Document pdf doc*, docx*, odt*, odp*, ods*, ppt*, pptx*, xls*, xlsx*, bmp, exr, ico, jpg, jpeg, png, psd, svg, tiff, tga

* You need to have Microsoft Office installed and activated in order to convert Office documents.

This program, as well as the VBScript method, uses the Microsoft Office automation method to convert .xls/.xlsx to PDF files. This means that you’ll need to have Office installed and activated on your computer for the program to convert your Excel spreadsheets.

Exit mobile version