<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>53</id><slug>exporting-scraped-data-to-csv-part-3-53</slug><title>Exporting scraped data to CSV, part 3</title><excerpt>This is part 3 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>3</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 3 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>Step by step</heading><paragraphs><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>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</item><item>Validate the data you extract. Prices without currencies, dates without time zones and empty fields are common sources of silent errors downstream.</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>5</authorId><authorName>Chen Patel</authorName><authorSlug>chen-patel</authorSlug><category>Data Engineering</category><tags><item>ethics</item><item>python</item><item>playwright</item></tags><publishedAt>2023-12-03T00:00:00.000Z</publishedAt><wordCount>166</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
