0

I have an excel spreadsheet, which contains 5 columns and 30 rows. All column and row information are already filled in. What I would like to do is take this worksheet and send a request to an api to make, for example, a product registration. This product registration within the API would be according to the column and row names. How could I do this in python?

EDIT:

To make requests in this api:

url = "https://myurl/api/catalog/pvt/product"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "API-AppKey": "MYKEY",
    "API-AppToken": "MYTOKEN"
}

response = requests.post(url, headers=headers, data=payloads)
response = response.json()

In my excel file, column A is column Name. Column B is the Category column, price column C.. and so on.

5
  • If you open up your excel sheet using pandas, you can use the df.to_json() method to dump it into json format. Commented Jun 1, 2022 at 4:06
  • Welcome to SO, there are quite a few details missing here. How do you send the data to the API? - can you include some documentation or an example? How is your Excel file formatted exactly (what row is what)? - Can you include an example please? Commented Jun 1, 2022 at 4:07
  • you can refer this answer stackoverflow.com/a/67001137/12410821 Commented Jun 1, 2022 at 4:11
  • thank you, @Dev! I managed to convert! but.. and to send this json file to my api? how would i do? sorry if the questions are confusing, i'm new to programming. Commented Jun 1, 2022 at 4:19
  • 1
    @FreddyMcloughlan I made some edits in The question Commented Jun 1, 2022 at 4:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.