1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:37:47 +00:00

Spreadsheet: Make the CSV reader more lenient

This adds an option "Lenient" that makes the reader conform to what
appears to be the norm in spreadsheet-land:
- Treat missing values as empty ones
- Update previously read rows if another row with more columns are seen
  afterwards
This commit is contained in:
AnotherTest 2021-03-27 16:59:25 +04:30 committed by Andreas Kling
parent 102065a8a9
commit 894bfa30a2
3 changed files with 28 additions and 5 deletions

View file

@ -41,6 +41,10 @@ enum class ParserBehaviour : u32 {
TrimLeadingFieldSpaces = ReadHeaders << 2,
TrimTrailingFieldSpaces = ReadHeaders << 3,
QuoteOnlyInFieldStart = ReadHeaders << 4,
Lenient = ReadHeaders << 5, // This is the typical "spreadsheet import" behavior
// Currently, it:
// - fills in missing fields with empty values
// - updates previous rows with extra columns
};
ParserBehaviour operator&(ParserBehaviour left, ParserBehaviour right);