Help to Get pdf file Names from Excel and to combine it?

Hi Guys,

I am using Mac OS X “Yosemite” - Version 10.10.5, Adobe Acrobat Pro XI - Version XI, Script Editor - Version 2.7.

I had excel file with pdf file names as follows. The pdf files are in source folder. What I need is, to read the file names from the excel and to combine source 1 and source 2 pdf file an to save as it as Output file name in and default folder i.e.
Combine Test1.pdf & Insert1.pdf and to save as xxx.pdf. Likewise all rows

Source 1 Source 2 Output File Name
Test1.pdf Insert1.pdf xxx.pdf
Test8.pdf Insert5.pdf aaa.pdf
Test4.pdf Insert4.pdf bbb.pdf
Test2.pdf Insert6.pdf zzz.pdf
Test7.pdf Insert1.pdf ddd.pdf

Can it possible to do with Applescript?

Thanks in Advance.


If I understand you correct.

You say:

Read the file names from Excel…you also say you like to have pdf output of the result file.

If that means you have excel document and like to import PDF files… to later export PDF output.

Why do you not export all your documents to PDF

Automator Combine PDF pages action could join your files.
If you check that action bundle you will find a python script

If you still use python that Apple provide…

I guess it’s possible to run that script in terminal to join pdf files.

It use CoreFoundation and Quartz.CoreGraphics so it doesn’t support python 3 if I’m correct.

This is Shane Stanley Script from 2015 :))

use scripting additions
use framework "Foundation"
use framework "Quartz" -- required for PDF stuff

set inFiles to (choose file of type {"pdf"} with prompt "Choose your PDF files:" with multiple selections allowed)
set destPosixPath to POSIX path of (choose file name default name "Combined.pdf" with prompt "Save new PDF to:")
its combineFiles:inFiles savingTo:destPosixPath

on combineFiles:inFiles savingTo:destPosixPath
   -- make URL of the first PDF
   set inNSURL to current application's class "NSURL"'s fileURLWithPath:(POSIX path of item 1 of inFiles)
   -- make PDF document from the URL
   set theDoc to current application's PDFDocument's alloc()'s initWithURL:inNSURL
   -- loop through the rest
   set oldDocCount to theDoc's pageCount()
   set inFiles to rest of inFiles
   repeat with aFile in inFiles
       -- make URL of the next PDF
       set inNSURL to (current application's class "NSURL"'s fileURLWithPath:(POSIX path of aFile))
       -- make PDF document from the URL
       set newDoc to (current application's PDFDocument's alloc()'s initWithURL:inNSURL)
       -- loop through, moving pages
       set newDocCount to newDoc's pageCount()
       repeat with i from 1 to newDocCount
           -- get page of old PDF
           set thePDFPage to (newDoc's pageAtIndex:(i - 1)) -- zero-based indexes
           -- insert the page
           (theDoc's insertPage:thePDFPage atIndex:oldDocCount)
           set oldDocCount to oldDocCount + 1
       end repeat
   end repeat
   set outNSURL to current application's class "NSURL"'s fileURLWithPath:destPosixPath
   -- save the new PDF
   (theDoc's writeToURL:outNSURL)
end combineFiles:savingTo: