DEV Community

Honson Young
Honson Young

Posted on

Notes from Parsing Shopify, eBay, and Whatnot Order CSVs in the Browser

While putting together a small client-side packing slip tool for multi-channel sellers, I assumed reading marketplace order exports would be a ten-minute job with a CSV parser library.

It turned out every platform export has its own quirks that silently break order grouping or thermal printing if you don't handle them upfront. Here are the four things that tripped us up while testing real Shopify, eBay Seller Hub, and Whatnot exports locally in the browser.

1. Shopify multi-item rows repeat the order ID, not the item title

In Shopify's orders_export_1.csv, a single order with three SKUs spans three rows. They all share the same Name (for example #1041), while Lineitem name and Lineitem sku change per row.

Early on, a lot of folks (and quick scripts) mistakenly group by Lineitem name or skip checking blank shipping cells on line 2 and line 3. If you do that, one buyer's order gets split into separate packing slips. Always group by Name (the order key), and carry forward the shipping address from the first row of that group.

2. Never merge orders by buyer name or email

A surprising edge case in live-selling channels like Whatnot or eBay: the same buyer often checks out twice in one livestream.

If you group by Buyer Username or email instead of strictly by Order ID, two distinct shipments with different tracking records get collapsed onto a single slip. Grouping strictly by Order ID keeps separate labels matched to separate packages while still letting you sum SKUs cleanly into a batch pick list.

3. UTF-8 BOM and Excel ruining tracking numbers

Many marketplace exports include a UTF-8 BOM (\uFEFF) at the start of the header row. If your browser parser doesn't strip it, the very first column name (often Order ID or Name) fails exact header matching even though it looks identical in console.log.

Also, sellers often open their exported CSV in Excel first just to peek at it, and then hit Save. Excel immediately converts long tracking numbers into 1.23E+11 and strips leading zeros off ZIP codes like 07001 into 7001. If you're parsing seller-edited files, flag scientific notation strings during validation before anything goes to a printer.

4. Chrome's print dialog vs. 4x6 thermal rolls

Getting @page { size: 4in 6in; margin: 0; } right in CSS is only half the battle. In desktop browsers, if the user leaves print Scale on "Fit to page" or Margins on "Default", the 4x6 layout shrinks or overflows onto a blank second thermal label every single time. Keeping the container slightly inside 3.8in x 5.8in with box-sizing: border-box and reminding users to switch Scale to 100% / Actual Size saves a lot of wasted labels.


Test fixtures if you're building something similar

To regression-test these edge cases without touching real customer PII, I put together a small MIT-licensed repository of fictional sample CSVs covering Shopify, eBay, Whatnot, same-buyer multi-order rows, and intentionally broken rows:

If you've run into weird CSV column headers on Etsy or WooCommerce exports, feel free to drop an example or open an issue on the repo.

Top comments (0)