{"record":{"id":"2589bb1c270be335","repo":"pentaho/pentaho-kettle","slug":"excelinput-exception-invalidtypedate","errorCode":"ExcelInput.Exception.InvalidTypeDate","errorMessage":"ExcelInput.Exception.InvalidTypeDate","messagePattern":"ExcelInput\\.Exception\\.InvalidTypeDate","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInput.java","lineNumber":332,"sourceCode":"  }\n\n  private void checkType( KCell cell, ValueMetaInterface v ) throws KettleException {\n    if ( !meta.isStrictTypes() ) {\n      return;\n    }\n    switch ( cell.getType() ) {\n      case BOOLEAN:\n        if ( !( v.getType() == ValueMetaInterface.TYPE_STRING || v.getType() == ValueMetaInterface.TYPE_NONE || v\n          .getType() == ValueMetaInterface.TYPE_BOOLEAN ) ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"ExcelInput.Exception.InvalidTypeBoolean\", v\n            .getTypeDesc() ) );\n        }\n        break;\n\n      case DATE:\n        if ( !( v.getType() == ValueMetaInterface.TYPE_STRING || v.getType() == ValueMetaInterface.TYPE_NONE || v\n          .getType() == ValueMetaInterface.TYPE_DATE ) ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"ExcelInput.Exception.InvalidTypeDate\", cell\n            .getContents(), v.getTypeDesc() ) );\n        }\n        break;\n\n      case LABEL:\n        if ( v.getType() == ValueMetaInterface.TYPE_BOOLEAN\n          || v.getType() == ValueMetaInterface.TYPE_DATE || v.getType() == ValueMetaInterface.TYPE_INTEGER\n          || v.getType() == ValueMetaInterface.TYPE_NUMBER ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"ExcelInput.Exception.InvalidTypeLabel\", cell\n            .getContents(), v.getTypeDesc() ) );\n        }\n        break;\n\n      case EMPTY:\n        // OK\n        break;\n\n      case NUMBER:","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInput.java#L314-L350","documentation":"ExcelInput.checkType() throws this KettleException when an Excel cell contains a DATE but the field's ValueMeta target type is not String, None, or Date. The step refuses to convert a date cell into an incompatible declared type.","triggerScenarios":"fillRow() encounters a date-typed cell while the mapped field is declared as Integer, Number, Boolean, or BigNumber in the Excel Input step metadata.","commonSituations":"Excel auto-detected real dates in a column the developer typed as Number, or the sheet was reformatted to date cells after the step fields were configured.","solutions":["Change the field's Type to Date (with the proper Format) or String in the Excel Input step dialog","If a numeric representation is required, read as Date then use 'Calculator'/'Formula' to convert downstream","Check the Excel sheet formatting: format the column as text/number if dates were unintended","Use Preview rows to verify the detected cell type before running"],"exampleFix":"// before\nfield: columnName=orderDate, type=Number\n// after\nfield: columnName=orderDate, type=Date, format=yyyy-MM-dd","handlingStrategy":"validation","validationCode":"int cellType = cell.getType();\nint fieldType = v.getType();\nboolean ok = cellType == KCellType.DATE\n  && ( fieldType == ValueMetaInterface.TYPE_STRING\n    || fieldType == ValueMetaInterface.TYPE_NONE\n    || fieldType == ValueMetaInterface.TYPE_DATE );\nif ( !ok ) { /* set field type to Date or String in step metadata */ }","typeGuard":"boolean acceptsDateCell( ValueMetaInterface v ) {\n  int t = v.getType();\n  return t == ValueMetaInterface.TYPE_STRING\n    || t == ValueMetaInterface.TYPE_NONE\n    || t == ValueMetaInterface.TYPE_DATE;\n}","tryCatchPattern":"try {\n  row = excelInput.fillRow( cells, ... );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"InvalidTypeDate\" ) ) {\n    // change the field type to Date (with a format mask) and rerun\n  }\n}","preventionTips":["Declare date columns as Date type with an explicit format mask","Check Excel cell formatting when a column switches to real dates","Preview rows after any sheet format change"],"tags":["pdi","excel-input","type-mismatch","date"],"backgroundTag":"type-mismatch","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}