Skip to main content
Version: 3.4

Export entire dataset to one file

This Dataset example uses the exportToValue function to export the entire default dataset to a single CSV file into a key-value store named "my-data".

import { Dataset } from 'crawlee';

// Retrieve or generate two items to be pushed
const data = [
{
id: 123,
name: 'foo',
},
{
id: 456,
name: 'bar',
},
];

// Push the two items to the default dataset
await Dataset.pushData(data);

// Export the entirety of the dataset to a single file in
// a key-value store named "my-data" under the key "OUTPUT"
await Dataset.exportToCSV('OUTPUT', { toKVS: 'my-data' });