{"data":{"id":53,"slug":"exporting-scraped-data-to-csv-part-3-53","title":"Exporting scraped data to CSV, part 3","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…","seriesName":"Exporting scraped data to CSV","seriesPart":3,"sections":[{"heading":"Introduction","paragraphs":["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."]},{"heading":"Step by step","paragraphs":["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.","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."]},{"heading":"What to watch for","paragraphs":["Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.","Validate the data you extract. Prices without currencies, dates without time zones and empty fields are common sources of silent errors downstream."]},{"heading":"Key takeaway","paragraphs":["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."]}],"authorId":5,"authorName":"Chen Patel","authorSlug":"chen-patel","category":"Data Engineering","tags":["ethics","python","playwright"],"publishedAt":"2023-12-03T00:00:00.000Z","wordCount":166,"readingTimeMinutes":2}}