
Announcements
Hi @Maad ,
1. Prepare Your Python Script:
• Modify your Python script to accept the target folder path and report file name as arguments. This allows PAD to dynamically set these values during execution.
2. Run Python Script in PAD:
• In PAD, use the "Run Python Script" action.
• In the script path, specify the location of your Python script.
• Define two variables in PAD:
o FolderPath: This will store the location where you want to save the report. You can set this before running the script.
o ReportName: This will hold the desired name for the generated report. This can be a static value or built dynamically based on the extracted data.
3. Pass Arguments to Python Script:
• In the "Run Python Script" action, configure the arguments:
o Add two arguments, one for FolderPath and another for ReportName.
o Set the value of each argument to the corresponding PAD variable (%FolderPath% and %ReportName%).
4. Python Script Saves the Report:
• Inside your Python script, use the provided FolderPath and ReportName to construct the complete file path where the report should be saved.
• Use libraries like pandas or csv to write the final report data to the constructed file path.
Please find the Example:
import pandas as pd
def generate_report(folder_path, report_name, data):
# Process and filter data
# Create the report dataframe
report_df = pd.DataFrame(data)
# Construct the file path
file_path = f"{folder_path}/{report_name}.xlsx"
# Save the report to the specified location
report_df.to_excel(file_path, index=False)
# Get folder path and report name from PAD variables
folder_path = sys.argv[1]
report_name = sys.argv[2]
# Generate report using your data processing logic
generate_report(folder_path, report_name, your_extracted_data)
Remember Python in PAD support only 2.7 and 3.4 Versions.
(Note:- if you got your solution you can mark as solution and gives kudos)
Thanks & Regards
Vishnu Reddy