Skip to main content

Hi,

I'm trying to create an Action Flow that allows me to convert a CSV file to XLSX and then send it via email.

Current Flow:
The user enters their email in the application view and clicks the "Send Email" button.

  • A webhook retrieves the data.
  • We then use Celonis Get Rows to fetch data for a specific Account ID (one Account ID may have more than one document).

     

  • The data from Get Rows is added to a CSV file.

Expected Solution:
Instead of saving the data to CSV, I would like to:

  1. Aggregate the data differently, e.g., fetch it from another HTTP output or webhook.
  2. Use ML Workbench in Celonis to convert the JSON format to XLSX.
  3. Then send the XLSX file back to Action Flow to attach it to the email.

Question:
Is it possible to implement such a solution? Or is there a simpler way to generate an XLSX file as an output?

Hi Wojciech, 

I think the best is to get the data and pass it in a form of parameters for ML script (I think AR Sailfin App was having working examples of triggering ML python scripts with AF done differently than that in documentation - you could ask Celonis support and share general approach if there’s a big difference :)), transforming JSON into Dataframe in ML and then into excel file. However I’m not sure how to attach excel file from ML workbench to Outlook module, so theoretical way to achieve this would be:

Step 1) Run Notebook using only AF (you can also try to mix signals but I wouldn’t advice on that, documentation below):
Step 2) Convert Json into Dataframe (example provided)
Step 3) Convert Dataframe into excel (example provided_
Step 4) Convert excel into binary? (IO/BytesIO + Openpyxl?)
Step 5) Run AF sending email attaching binary? (documentation below + passing binary excel file as a parameter/input for AF)

Documentation Triggering ML script with AF: Trigger Machine Learning ScriptDocumentation - passing parameters: Forward Parameters to Machine Learning ScriptDocumentation - triggering AF from ML workbench: Trigger an Action Flow from ML WorkbenchDocumentation swagger for ML workbench API endpoints: https://hteamname].arealm].celonis.cloud/machine-learning/swagger-ui/index.html#/Small example for turning JSON into Excel file (of course need to instal openpyxl):
import json
import pandas as pd
import openpyxl

json_string = '''
{
"name": "Charlie",
"age": 35,
"address": {
"street": "123 Main St",
"city": "Munich"
},
"hobbies": "reading"
}
'''

data = json.loads(json_string)
df = pd.DataFrame(tdata], index=,0])
print(df)

# Export DataFrame to Excel
df.to_excel('output.xlsx', index=False)
Output:


Small example for DECODING binary to excel. I know it’s not the same but process should be fully reversable, so I would check if there’s no function for that.



Documentation for API ML workbench endpoints:


Hope that helped! :)

Best Regards,

Mateusz Dudek


Hi ​@wojciech.brol

Next to the proper data transformation solution that ​@mateusz.dudek14 suggests, you can check the Celonis Action Flow blueprint for inspiration purposes: https://docs.celonis.com/en/send-excel-file-via-mail.html


Hi, ​@mateusz.dudek14 , ​@janpeter.van.d ,
I wanted to thank you for your help in solving the problem. I’ve learned a lot thanks to your advice.

Action Flow generates Excel files, but I encountered difficulties with the ML Workbench API Endpoint—I can't directly retrieve the contents of the file. The only accessible data is the content within a given Notebook ID, but the API does not allow downloading the actual Excel file.

I tried to work around this issue using the download URL, but instead of getting the Excel file, I receive an HTML file that redirects to the actual download. Unfortunately, this solution does not work as expected. It seems we’ll have to wait for Celonis to introduce the appropriate endpoint ;)

 

 


Reply