Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have api which gives json output now i want to save it as excel using xlsxwriter
i searched online but no luck kindly guide

What I have tried:

<pre>@DATAQU.route('/start_date-end_date', methods=['GET'])
def subscription_date():
    subscription_id = request.args.get('subscription_id')
    email = request.args.get('email')
    update_query = '''
            select rmdata.subscription.id, start_date, end_date, column_name, column_value, display_text  from rmdata.subscription 
            join rmdata.subscription_user on rmdata.subscription_user.subscription_id=rmdata.subscription.id
            join account on public.account.id =rmdata.subscription_user.account_id
            join rmdata.market_filter on market_filter.subscription_id=rmdata.subscription.id 
            where email = :a and rmdata.subscription.active is true limit 1
            '''
    result = db.session.execute(text(update_query), {'a':email})
    final = [dict(i) for i in result]
   
    return{"sub_start_date_end_date":final}
Posted
Updated 18-Sep-20 23:54pm
Comments
Richard MacCutchan 18-Sep-20 8:49am    
"but no luck kindly guide"
In respect of what? You have not asked a question.

1 solution

Quote:
How to convert json to excel

Have a look at them and try out:
json-excel-converter · PyPI[^]
How to Convert JSON to Excel in Python with Pandas[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900