Simply parse the JSON and extract the content field only, then write into file
response_json = json.loads(response.content) file_content = response_json["content"] with open('template.xlsx', 'wb') as f: f.write(file_content)