0

I want to build a Jenkins cron job, which fetches data from firebase into json format and then convert that data into csv or xlsx file and put it into one drive.

I have achieved fetching data from firebase, but stuck on converting it to csv and then save to one drive.

Dharmik soni
  • 343
  • 2
  • 16

1 Answers1

0

There are multiple ways to convert a json file to csv but considering the scenario that you are working with jenkins and might have a shell as build step, so in that case you can use jq utility. there are multiple answers which can help you.

if you are open to use any other option for build then you can use python also. which makes it much easier.

you can use pandas module from python to convert a json file to csv using below code.

import pandas as pd

with open('data.json', encoding='utf-8') as stream:
    df = pd.read_json(stream)

df.to_csv('data.csv', encoding='utf-8', index=False)
Chandella07
  • 2,089
  • 14
  • 22