Skip to content

Import custom yields from Excel/CSV in the browser #127

Description

@paccloud

What to build

A person picks a .xlsx or .csv file on My data. The browser parses it, shows a preview of the rows it will import and the rows it will skip (with the reason), then writes the accepted rows to Firestore as custom yields. There is no server upload (ADR 0001 in #122).

The import and export format has separate starting form and finished product columns, so a row maps onto a conversion. A row without a starting form, such as one from an older file with only a product column, imports with the starting form blank. Like the Neon copy, it stays private and can't be submitted until the owner fills it in. The downloadable template and My data export use the new columns.

The same import also accepts the unsent-changes file saved from the read-only old app (#130). This covers a device that stayed offline through the switch, so its custom yields and saved calculations still reach the new app.

Keep today's parsing rules, which were fixed in #113:

  • Only XLSX cells with a real percent number format stay numbers and are multiplied by 100. A % inside quotes or escaped with a backslash doesn't count.
  • Every other cell is read as text, so a CSV 0.5 means 0.5%.
  • Yields outside the range above 0 and up to 100 are skipped.

Acceptance criteria

  • XLSX and CSV import works entirely in the browser
  • The format has starting-form and finished-product columns, and the template and export use them
  • A row with only a product column imports with a blank starting form and is marked as needing one on My data
  • A preview shows the rows to import and the rows skipped, each with a reason, before anything is written
  • Importing an existing species + conversion updates it instead of adding a duplicate
  • The percent-format and range rules above are covered by tests ported from the current import tests
  • The unsent-changes file from the old app imports both custom yields and saved calculations, with the same preview
  • Files that are too large or of the wrong type are refused with a clear message

Blocked by

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions