Skip to main content

Hi I've tried to use The Excel To PDF Writer but i have problems

after some errors about phyton stuff i have installed pywin32 and pypiwin32

 

 

https://docs.safe.com/fme/2021.0/html/FME_Desktop_Documentation/FME_Workbench/Workbench/Installing-Python-Packages.htm

 

fme.exe python -m pip install pywin32 --target C:\\Users\\<username>\\Documents\\FME\\Plugins\\Python

fme.exe python -m pip install pypiwin32 --target C:\\Users\\<username>\\Documents\\FME\\Plugins\\Python

 

fme.exe python -m pip list

 

it was successfully

 

but again an error message

 

 

ExcelToPDFWriter_ConvertPDF (PythonFactory): Splitting bulk features into individual features

Python Exception <ModuleNotFoundError>: No module named 'win32api'

Error executing string `"""

Converter from Excel (.xlsx) to PDF (.pdf).

This module depends on the following modules:

   - pywin32

To install open an elevated command prompt and enter: pip3 install <module_name>.

Heijmans

18-04-18

Rob Braggaar

Can somebody maybe help where is the error.....what i am doing wrong?

 

Cheers and Greetz Franco

 

 

Hi @franco69​ sorry to hear you are having trouble with this issue, have you taken a look at this post? It may be helpful.


I've installed the phyton stuff right and copied the two .dll files correctly

but always the same error.......I'm not the phyton guru but it would be very nice if i yould test this transformers for an important task or is another possibility to convert excel sheets to pdf in the meantime in the new 2022 release?

 

here is my error message:

 

Python Exception <ModuleNotFoundError>: No module named 'win32api'

Error executing string `"""

Converter from Excel (.xlsx) to PDF (.pdf).

This module depends on the following modules:

- pywin32

To install open an elevated command prompt and enter: pip3 install <module_name>.

Heijmans

18-04-18

Rob Braggaar

"""

import win32com.client

import fme

import fmeobjects

def main(feature):

logger = fmeobjects.FMELogFile()

input = str(feature.getAttribute('filepath'))

sheets = str(feature.getAttribute('sheets'))

sheets = sheets.split(',')

for idx in range(len(sheets)):

sheetstidx] = int(sheetstidx])

def convert(in_wb_path, out_pdf_path):

""" Converts input file to output pdf """

print('Input: ', in_wb_path, '\\nOutput:', out_pdf_path)

excelHandler = win32com.client.Dispatch("Excel.Application")

excelHandler.Visible = 0 # do not show Excel to the user

print('Starting conversion...')

wb = excelHandler.Workbooks.Open(in_wb_path, ReadOnly=1)

print('Workbook opened...')

# Excel sheets to export to the pdf destination.

ws_index_list = sheets

logger.logMessageString('Exporting sheets: {}'.format(str(sheets)))

print('Selecting worksheets {}...'.format(ws_index_list))

wb.Sheets(ws_index_list).Select() # WorkSheets

print('Worksheets opened...')

wb.ActiveSheet.ExportAsFixedFormat(0, out_pdf_path)

print('Done.')

# process wrap up

# close the workbook

excelHandler.Workbooks.Close()

# quit the Excel process

excelHandler.Application.Quit()

convert(input, input.rstrip('.xlsx') + '.pdf')'

Factory proxy not initialized

ExcelToPDFWriter_ConvertPDF (PythonFactory): PythonFactory failed to process feature

ExcelToPDFWriter_ConvertPDF (PythonFactory): A fatal error has occurred. Check the logfile above for details

Excel Reader: Closing dataset 'D:\\Projekte\\R796_Excel\\JULY_OP\\BGU\\PA7\\08_Labor\\x_Probedaten\\Probenlisten\\PA7_BK-Lager_Münnerstadt_Probenliste_gesamt_20220624.xlsx'...

Styles created: 303

Excel Reader: Closing dataset 'D:\\Projekte\\R796_Excel\\JULY_OP\\BGU\\PA7\\08_Labor\\x_Probedaten\\Probenlisten\\PA7_BK-Lager_Münnerstadt_Probenliste_gesamt_20220624.xlsx'...

A fatal error has occurred. Check the logfile above for details

Translation FAILED with 6 error(s) and 0 warning(s) (0 feature(s) output)

FME Session Duration: 3.3 seconds. (CPU: 0.7s user, 0.5s system)

END - ProcessID: 2284, peak process memory usage: 100972 kB, current process memory usage: 76128 kB

A fatal error has occurred. Check the logfile above for details

Program Terminating

Translation FAILED.


Reply