-1

There is an excel spreadsheet that lives on an endpoint, where when pinged by a get request will return an excel speadsheet .xlsx. It works on postman, however predictably returns a binary that it cannot understand. How can i go about consuming this file as a pandas dataframe (or similar), parse a row, then return a JSON using python flask?

0

1 Answer 1

0

For Python, you may download the spreadsheet file to a temporary directory using a library such as urllib.request.

import urllib.request


urllib.request.urlretrieve(SPREADSHEET_URL, SAVE_AS_NAME.xlsx)

Once the file has been downloaded, simply load the spreadsheet file into your library of choice. For example, Pandas:

import pandas as pd


df = pd.read_excel(SAVE_AS_NAME)
...
# The first row all columns
df.loc[0,:]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.