Skip to content
PD
Парсинг данных

Scraping to Excel: Exporting the Results

Which format to deliver collected data in, why a spreadsheet is not always the right choice, how to avoid the usual encoding and number problems, and how to arrange regular updates.

All articles in the guide Парсинг данных · 11

Collecting the data is half the task. The other half is delivering it in a form people can work with, and there are non-obvious traps.

Choosing a format

A spreadsheet. For humans: viewing, sorting, filtering. Types survive, encoding is not a problem, and it can be formatted.

CSV. For passing between programs. Simple, opens everywhere, and responsible for most of the problems: encoding, separators, quotes inside values.

A database. For volume and ongoing use. Mandatory when data updates and history matters.

JSON. For nested structures that do not fit a flat table.

A common mistake: using a spreadsheet as storage. At tens of thousands of rows it becomes slow, and with regular updates, fragile. The right arrangement at volume is data in a database, spreadsheets generated on demand.

Common problems

Encoding. The classic: unreadable characters instead of letters. The file was saved in one encoding and opened in another. Fixed by specifying the encoding on import or saving to a spreadsheet format directly.

Product codes becoming numbers. Leading zeros disappear and long values turn into scientific notation. Such fields must be text - mark them on import or save directly to a spreadsheet format with types set.

Dates guessed wrongly. Anything resembling a date is read as one, sometimes in a foreign format. Particularly unpleasant with codes like “5-10”.

Separators. A value containing a comma breaks CSV unless escaped. Quotes inside a value do the same.

Line breaks inside a cell. A description with paragraphs turns one row into several.

Numbers with spaces and currency symbols. Convert at collection time rather than later in the editor.

The general rule: convert data to the right types at collection time rather than hoping the spreadsheet guesses. It will guess, and wrongly - see scraping in Python.

Export structure

What to include besides the data itself:

  • Collection date and time. Without it, a month later nobody knows how fresh the data is.
  • The source for every row, especially when collecting from several sites.
  • Collection conditions where they matter: region, price type - see scraping products.
  • A link to the original page. It makes manual verification possible and saves enormous time when investigating discrepancies.
  • A problem flag. Rows where some fields failed to collect must be marked rather than look complete.

A separate summary sheet or file - record count, error count, run time - turns an export into a report that shows whether the data can be trusted.

Regular updates

If the export is not a one-off:

Do not overwrite the file. Keep versions or write to a database and generate the spreadsheet. An overwritten file cannot be compared with its predecessor.

Flag changes separately. What appeared, what disappeared, what changed is usually more valuable than a full snapshot.

Automate delivery. A file that must be fetched by hand will stop being fetched. Emailing it or dropping it into a shared folder on a schedule solves that - see workflow examples.

Notify on failure. A missing file must be noticeable. An empty report beats an absent one: it shows the system ran.

The overview is in the scraping guide. Getting a table straight off a page: scraping tables.

FAQ

Which format should scraping results be delivered in?

A spreadsheet file for humans to read, CSV for passing between programs, a database for volume and ongoing use. A common mistake is using a spreadsheet as storage: at tens of thousands of rows it becomes slow and fragile.

Why does my CSV show garbled characters?

Encoding: the file was saved in one and is being opened in another. Fixed either by specifying the encoding on import or by saving directly to a spreadsheet format, where encoding is not a separate problem.

Why do product codes turn into numbers and lose leading zeros?

Because the spreadsheet guesses column types and converts text to numbers: leading zeros vanish, long values become scientific notation, and some values are read as dates. Mark such fields as text on import, or save directly to a spreadsheet format with types already set.

More on this topic

Done for you

I will build a parser for your source

With protection bypass, proxies and export to a sheet, a database or Telegram. It runs on a schedule without you.

from $300 · 3 to 7 days

Similar caseEtsy Keyword FinderA queue-driven keyword audit app for Etsy sellers: submit a listing ID plus up to 20 keywords, and background workers walk the real search results step by step with live screenshots.

"Very fast parsing, thank you! It even returned a few more numbers than expected, I recommend him to everyone. I have ordered twice now, happy with all of it, and I will be back."

sotasoftdv · KworkTranslated from Russian