You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HI, I'm trying to parse a csv file which was exported from spreadsheet, but the csv parser failed when a cell doesn't have any value:
import"package://pkg.pkl-lang.org/pkl-pantry/[email protected]#/csv.pkl"data = """ Column1, Column2, Column3, Column 4 Value 1, Value 2,, Value 4 """csvData = newcsv.Parser {
input = data
includeHeader = true
}.parsed
But got pkl error:
–– Pkl Error ––
Expected value of type `String`, but got `null`.
188 | let (header: List<String>? = (if (includeHeader) stringyResult[0] else properties?.keys)?.toList() as List<String>?)
^^^^^^
at pkl.csv.csv#Parser._parsed.<function#3> (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.csv/csv.pkl#L188-188)
187 | let (properties: Map<String,reflect.Property>? = rowClass.ifNonNull((clazz) -> allProps(reflect.Class(clazz as Class))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at pkl.csv.csv#Parser._parsed.<function#2> (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.csv/csv.pkl#L187-203)
182 | let (stringyResult = new StringyTableParser {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at pkl.csv.csv#Parser._parsed.<function#1> (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.csv/csv.pkl#L182-203)
181 | let (self = this)
^^^^^^^^^^^^^^^^^
at pkl.csv.csv#Parser._parsed (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.csv/csv.pkl#L181-203)
164 | _parsed
^^^^^^^
at pkl.csv.csv#Parser.parsed (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.csv/csv.pkl#L164-164)
8 | csvData = new csv.Parser {
^^^^^^^^^^^^^^^^
at kv2#csvData (file:///Users/namnguyen/scripts/vault/kv2.pkl, line 8)
106 | text = renderer.renderDocument(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at pkl.base#Module.output.text (https://github.com/apple/pkl/blob/0.26.3/stdlib/base.pkl#L106)
Coming from python's csv (I know it's apple to orange comparison, but anyway), I don't expect this error.
The text was updated successfully, but these errors were encountered:
HI, I'm trying to parse a csv file which was exported from spreadsheet, but the csv parser failed when a cell doesn't have any value:
But got pkl error:
Coming from python's csv (I know it's apple to orange comparison, but anyway), I don't expect this error.
The text was updated successfully, but these errors were encountered: