Answer the question
In order to leave comments, you need to log in
Win32com.client xlsx to pdf - how to save formulas?
Good afternoon! I am working with an Excel spreadsheet and I want to upload it in two versions: xlsx and pdf. The problem is that in xlsx the formula works correctly, but in pdf it says in place of the formula:
::::NAME???
import win32com.client
Excel = win32com.client.Dispatch("Excel.Application")
Excel.Visible = 0
wb1 = Excel.Workbooks.Open(u'D:\\Python\\Bot\\Форма.xlsx')
sheet1 = wb1.ActiveSheet #выбрал активный лист
val1 = sheet1.Cells(1,2).value #забрал данные
wb1.Save() #сохранил книгу
wb1.Close() #закрыл книгу
wb2 = Excel.Workbooks.Open(u'D:\\Python\\Bot\\Счет-фактура.xlsx')
sheet2 = wb2.ActiveSheet
sheet2.Cells(9,3).value = val1 #отдал данные
wb2.Save() #сохранил xlsx
wb2.ExportAsFixedFormat(0,'D:\\Python\\Bot\\Счет-фактура.pdf') #'D:\\Python\\Bot\\Счет-фактура.pdf'
#сохранил pdf
wb2.Close() #закрыл книгу
Excel.Quit() #закрыл процесс
Answer the question
In order to leave comments, you need to log in
Try to copy the contents of the cells and paste them into them, but only as values, without formulas.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question