With the help of this .doc to pdf using python
Link I am trying for excel (.xlsx and xls formats)

Following is modified Code for Excel:

import os
from win32com import client

folder = "C:\\Oprance\\Excel\\XlsxWriter-0.5.1"
file_type = 'xlsx'
out_folder = folder + "\\PDF_excel"

os.chdir(folder)

if not os.path.exists(out_folder):
    print 'Creating output folder...'
    os.makedirs(out_folder)
    print out_folder, 'created.'
else:
    print out_folder, 'already exists.\n'

for files in os.listdir("."):
    if files.endswith(".xlsx"):
        print files

print '\n\n'

word = client.DispatchEx("Excel.Application")
for files in os.listdir("."):
    if files.endswith(".xlsx") or files.endswith('xls'):
        out_name = files.replace(file_type, r"pdf")
        in_file = os.path.abspath(folder + "\\" + files)
        out_file = os.path.abspath(out_folder + "\\" + out_name)
        doc = word.Workbooks.Open(in_file)
        print 'Exporting', out_file
        doc.SaveAs(out_file, FileFormat=56)
        doc.Close()


It is showing following error : 

&gt;&gt;&gt; execfile('excel_to_pdf.py')
Creating output folder...
C:\Excel\XlsxWriter-0.5.1\PDF_excel created.
apms_trial.xlsx
~$apms_trial.xlsx

Exporting C:\Excel\XlsxWriter-0.5.1\PDF_excel\apms_trial.pdf
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "excel_to_pdf.py", line 30, in &lt;module&gt;
    doc = word.Workbooks.Open(in_file)
  File "&lt;COMObject &lt;unknown&gt;&gt;", line 8, in Open
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft Excel
', u"Excel cannot open the file '~$apms_trial.xlsx' because the file format or f
ile extension is not valid. Verify that the file has not been corrupted and that
 the file extension matches the format of the file.", u'xlmain11.chm', 0, -21468
27284), None)
&gt;&gt;&gt;


There is problem in

doc.SaveAs(out_file, FileFormat=56)

What should be FileFormat file format?
Please Help


Question: How can I adjust tax withholding so that I don't get a large Tax Refund?
Answer: 
  However this seems off because I would essentially be purposely
  filling out a form incorrectly.


Note that the only part of the W-4 form that is required to be filled out and given to the employer is the small certificate at the bottom that you tear off. In this part, it only asks you for "Total number of allowances you are claiming". You don't have to fill out any of the worksheets in the other parts of the form, which actually ask for specific information. Since there are different allowed ways of computing the "Total number of allowances you are claiming", I doubt that any number you put there can be said to be "incorrect".

I think that the best to use the IRS Withholding Calculator. If you use it, the calculator will probably tell you to claim a few more exemptions. And you don't have to feel bad about "filling the form incorrectly" if you follow the IRS calculator.