# How to fetch the data from gatling report and put that data in a csv?

**URL:** <https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045>\
**Category:** Gatling (Open-Source)\
**Tags:** gatling-academy\
**Created:** [June 19, 2023, 8:22am UTC](https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045 "2023-06-19T08:22:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![postmalone](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@postmalone](https://community.gatling.io/u/postmalone)\
**Post date:** [June 19, 2023, 8:22am UTC](https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045/1 "2023-06-19T08:22:18Z")

</div>

Is there any way in Gatling open source to fetch the data from Gatling report and put that data into a CSV file?

I have tried to create a python script that is taking the index.html report generated by Gatling once the test execution is completed but the problem is data in the index.html is getting filled by some javascript code the data is not present in the html. I have used bs4 to scrap but it didn’t work.

Can anyone please help me out.

My code:

```plaintext
def read_zip_file(zip_file_path,zip_file_path2,html_file):
    with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
    
    
    with zip_ref.open(zip_file_path2, 'r') as zip_ref2:
            inner_zip_data = zip_ref2.read()
            inner_zip = zipfile.ZipFile(io.BytesIO(inner_zip_data))
            with inner_zip.open(html_file) as html_file:
                html_content = html_file.read().decode('utf-8')
                soup = BeautifulSoup(html_content, "html.parser")
                containers = soup.find_all(id="container_statistics_body")
                td_element = soup.select_one('td.value.ok.col-3')
                print(containers)
                # with open("table.csv", "w", newline="") as csvfile:
                # writer = csv.writer(csvfile)
                # writer.writerow(columns)

zip_file_path = "USEast1login.zip"
zip_file_path2 = "results-aggregated-login-1684262709.zip"
html_file = 'aggregated-results/aggregated/index.html'

read_zip_file(zip_file_path,zip_file_path2,html_file)

```

---

<div class="post-metadata">

**Author:** ![GeMi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/gemi/32/939_2.png) [@GeMi](https://community.gatling.io/u/GeMi)\
**Post date:** [June 19, 2023, 9:45am UTC](https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045/2 "2023-06-19T09:45:27Z")

</div>

You can try to parse simulation.log but you must have in your mind this file is internal and can be changed without any information.  
Better way is to send by graphite protocol and parse as you want: [Gatling - Realtime Monitoring](https://gatling.io/docs/gatling/guides/realtime_monitoring/#graphite-integration)

---

<div class="post-metadata">

**Author:** ![postmalone](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@postmalone](https://community.gatling.io/u/postmalone)\
**Post date:** [June 19, 2023, 10:01am UTC](https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045/3 "2023-06-19T10:01:56Z")

</div>

is this is something we can do in open source?  
What I want is once the test execution is completed all the data present on index.html should be extracted to a csv file.

---

<div class="post-metadata">

**Author:** ![GeMi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/gemi/32/939_2.png) [@GeMi](https://community.gatling.io/u/GeMi)\
**Post date:** [June 20, 2023, 5:45am UTC](https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045/4 "2023-06-20T05:45:58Z")

</div>

I know you can, why do you ask? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [July 20, 2023, 5:46am UTC](https://community.gatling.io/t/how-to-fetch-the-data-from-gatling-report-and-put-that-data-in-a-csv/8045/5 "2023-07-20T05:46:37Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
