<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>133</id><slug>exporting-scraped-data-to-csv-part-7-133</slug><title>Exporting scraped data to CSV, part 7</title><excerpt>This is part 7 of our series, and this time we focus on edge cases readers asked about. CSV is the lingua franca of spreadsheets and the most common way scraped data leaves a project. It is also…</excerpt><seriesName>Exporting scraped data to CSV</seriesName><seriesPart>7</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 7 of our series, and this time we focus on edge cases readers asked about. CSV is the lingua franca of spreadsheets and the most common way scraped data leaves a project. It is also surprisingly easy to produce a CSV that opens incorrectly.</item></paragraphs></item><item><heading>Common pitfalls</heading><paragraphs><item>Pagination comes in several shapes: numbered pages, next links, offsets and opaque cursors. Each has trade-offs, and a robust scraper should detect the end of the result set rather than assuming a fixed number of pages.</item><item>Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot.</item><item>Selectors are the most fragile part of any scraper. Prefer stable attributes such as data-testid or semantic structure over generated class names, which can change on every deploy.</item></paragraphs></item><item><heading>What to watch for</heading><paragraphs><item>Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.</item><item>Store raw responses alongside parsed output while you are developing. When a parser breaks, you can replay the saved HTML instead of hitting the site again.</item><item>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Use a proper CSV writer rather than joining strings, quote fields that contain commas or newlines, write UTF-8, and keep dates in ISO 8601.</item></paragraphs></item></sections><authorId>6</authorId><authorName>Sofia Fischer</authorName><authorSlug>sofia-fischer</authorSlug><category>Data Engineering</category><tags><item>ethics</item></tags><publishedAt>2025-10-13T00:00:00.000Z</publishedAt><wordCount>227</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
