Is there a way to use XlsxWriter to get a worksheet by name?
import win32com.client, types, pythoncom, sys, os, string
import xlsxwriter
xlApp = win32com.client.Dispatch("Excel.Application")
for file in os.listdir("C:\Users\\Desktop\Escel"):
if file.endswith(".xlsx"):
fileName = file
books = xlApp.Workbooks.Open(r"C:\\Users\\Desktop\\Escel\\" + str(fileName))
ws = books.sheet_by_name("2015 Data")
#ws = books.Worksheets[0]
ws.Visible = 1
fileName.replace(".xlsx","")
ws.ExportAsFixedFormat(0, r"C:\\Users\\Desktop\\PDF\\" + str(fileName) + str(".pdf"))
books.Close(True, r"C:\\Users\\Desktop\\Escel\\" + str(fileName))