Introduction
Working with WayScript helps you automate simple tasks while you can focus on the important work.
Today, we’ll learn to use Python to programmatically write CSV files with pandas.
Prerequisites
No prerequisites but some content you might find helpful:
Time Trigger
To make the script running, we’ll simply use a Time Trigger.
Add it as a Trigger and choose whatever time suits you best.
Requests
WayScript provides a Requests module to easily make requests without having to write a single line of code. Add it as a new step.
We’ll make requests to Star Wars API. We’ll fetch all the planets of the Star Wars Universe using this endpoint. https://swapi.dev/api/planets/
Once it’s done we can write the Python Script to write the JSON data into a CSV file.
Python
WayScript also provides a Python module to execute python scripts in our workflow. Add it as a new step.
Once it’s added, we can write the script.
If you run the script, you’ll notice a new file in the project directory. Well, it’s our CSV file.
Well, here’s the content.
Conclusion
Questions about this script or anything else? Join our Discord. We're always around to help. If you want to work with the full script template, just find it here.
Top comments (0)