How to use Action Flow to convert a CSV file to XLSX?
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:
Aggregate the data differently, e.g., fetch it from another HTTP output or webhook.
Use ML Workbench in Celonis to convert the JSON format to XLSX.
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?
Page 1 / 1
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)
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.
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 ;)