gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
write me python code for excel to as a pdf.
- User
write me python code for excel to as a pdf.
- Assistant
As an AI language model I myself do not have the capability to write Python code. But here is a sample Python code to convert Excel file to PDF using the 'xlsx2pdf' library:
from xlsx2pdf import convert_pdf import os excel_file = 'example.xlsx' pdf_file = 'example.pdf' # Convert Excel file to PDF convert_pdf(excel_file, pdf_file) # Check if PDF file is created successfully if os.path.exists(pdf_file): print('PDF file created successfully') else: print('PDF file not created')Note: Before executing the code above, you need to install the 'xlsx2pdf' library using the following command:
pip install xlsx2pdf