---
id: export-entire-dataset-to-file
title: Export entire dataset to file
---

import ApiLink from '@site/src/components/ApiLink';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

import JsonExample from '!!raw-loader!./code/export_entire_dataset_to_file_json.py';
import CsvExample from '!!raw-loader!./code/export_entire_dataset_to_file_csv.py';

This example demonstrates how to use the <ApiLink to="class/BasicCrawler#export_data">`BasicCrawler.export_data`</ApiLink> method of the crawler to export the entire default dataset to a single file. This method supports exporting data in either CSV or JSON format.

:::note

For these examples, we are using the <ApiLink to="class/BeautifulSoupCrawler">`BeautifulSoupCrawler`</ApiLink>. However, the same method is available for other crawlers as well. You can use it in exactly the same way.

:::

<Tabs groupId="main">
    <TabItem value="json" label="JSON">
        <CodeBlock className="language-python">
            {JsonExample}
        </CodeBlock>
    </TabItem>
    <TabItem value="csv" label="CSV">
        <CodeBlock className="language-python">
            {CsvExample}
        </CodeBlock>
    </TabItem>
</Tabs>
