DEV Community

Derrick Sherrill for WayScript

Posted on

Automatically Write Excel files using Python, Pandas, and WayScript

Introduction

Using Python, pandas, and wayscript, we can programmatically write excel files and automate the executions in just a few minutes.

Prerequisites

No prerequisites but some content you might find helpful:

Time Trigger

For this tutorial, we’ll use the Time Trigger module. It allows us to execute the WayScript at a time we’ll define. Add it as a new trigger.

Time Trigger

Now, we can configure the Trigger.

Configuring the Trigger

Weather Data

WayScript provides a Weather module to integrate Open Weather Map's current weather and forecasts. Then, we’ll be able to make get weather data from any city without writing a line of code.

Adding the module

We’ll get data from New York. Make sure you have JSON_DATA selected.

Configuring the module

Writing to Excel using Python

With WayScipt, we can also execute scripts written in Python. Here, we’ll use the pandas Python library to normalize our JSON_DATA and save it in an excel file. Add it as a new step.

Adding the module

We can now write and execute the Python script.

Python Script

If you execute the script, you’ll notice a new file in the directory of your project. Here’s mine.

File system

You can download it here.

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)