Skip to main content

Excel

Microsoft Excel can load data from a UDF's HTTP Endpoint that returns a .csv.

1. Create a UDF

This example retrieves Caltrain live location data from GTFS real-time feed and returns it as a DataFrame.

@fused.udf
def udf(bbox: fused.types.TileGDF=None):
import requests
import pandas as pd

r = requests.get(f'https://www.caltrain.com/files/rt/vehiclepositions/CT.json')
j = r.json()
df = pd.json_normalize(j['Entities'])
return df

2. Create a URL for the UDF

Now, create an HTTP endpoint for the UDF.

Append this query parameter to the end of the URL to structure the response as a CSV type: ?dtype_out_vector=csv.

The generated URL should look like this:

https://www.fused.io/server/v1/realtime-shared/ccd781317018362a6966c9f12b27e95f1fe2fd88ff339de90eb9ac35b87cf439/run/file?dtype_out_vector=csv

3. Import Data to Excel

Open Excel, then click the Data tab in the top ribbon. Click From Web.

alt text

In the From Web dialog box, paste in the URL from your UDF, and click OK.

alt text

A preview of the data will be shown. Click Load to import the data to your Excel sheet. Optionally, you can click Transform to transform the data if needed.

alt text

The UDF will run and load its output data in a new Excel sheet.

alt text

Note: The desktop version of Microsoft Excel is required. Microsoft Excel Online does not support loading data from web sources.