'Excel is not converting all columns to PDF

I am trying to convert Excel to PDF, but it is converting only a few columns. Please help me out of this issue.

from win32com import client
  
# Open Microsoft Excel
excel = client.Dispatch("Excel.Application")
  
# Read Excel File
sheets = excel.Workbooks.Open('E:\TRANSPORTER_File\Template\Primary-MarketN.xlsx')
work_sheets = sheets.Worksheets[0]
  
# Convert into PDF File
work_sheets.ExportAsFixedFormat(0, 'E:\TRANSPORTER_File\Template\sds23d.pdf')
return "true"


Solution 1:[1]

I don't have your excel file but there's a possibility that printed areas were set when the file was published.

Try to set the argument 'IgnorePrintAreas' to True.

work_sheets.ExportAsFixedFormat(0, 'E:\TRANSPORTER_File\Template\sds23d.pdf', IgnorePrintAreas = True)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samantha Cruz