Input (Required)
Python script file, usually a text file with extension .py (see example below.)
Input (Optional)
Req Text
requirements.txt file is the standard text file that lists the 3rd party Python modules that the main Python script will be calling for.
https://pip.pypa.io/en/stable/user_guide/#requirements-files
Parameters
Parameters are defined in the main Python script (see example). You can pass on parameters by using the notation ::= as in Python
Encoding option
If the input file uses any other encoding options than UTF-8, you can specify it here.
Output
Return Value
This plugin does not return any values
Return Code
0 for success
9 for failure
How to set parameters
Example of files
Python script
file name = 1272966
Code Block | ||||
---|---|---|---|---|
| ||||
import glob import os import pandas as pd from pandas import ExcelWriter from openpyxl import load_workbook wdir = r"{wdir}" in_files = ( os.path.join(wdir, '1.xlsx'), os.path.join(wdir, '2.xlsx'), os.path.join(wdir, '3.xlsx'), ) out_file = os.path.join(wdir, 'task2.xlsx') writer = ExcelWriter(out_file, engine='openpyxl') num_rows = 0 for filename in in_files: excel_file = pd.ExcelFile(filename) (_, f_name) = os.path.split(filename) (f_short_name, _) = os.path.splitext(f_name) for sheet_name in excel_file.sheet_names: df_excel = pd.read_excel(filename) df_excel.to_excel(writer,index=False,header=False,startrow=num_rows+1) num_rows += df_excel.shape[0] writer.save() print(os.path.abspath(out_file), end='') |
File name = 1272966
Code Block | ||||
---|---|---|---|---|
| ||||
# requirements.txt for pandas handling openpyxl pandas |