Document Solutions for Excel, Java Edition | Document Solutions
com.grapecity.documents.excel Package / IRange Interface / importData Method / importData(Object,DataImportOptions) Method
The items to import. The element type can be: The collection type can be:
The import options.
In This Topic
    importData(Object,DataImportOptions) Method
    In This Topic
    Imports data from a data source (up to 2D) to the range.
    Syntax
    DataImportResult importData( 
       java.lang.Object items,
       DataImportOptions options
    )

    Parameters

    items
    The items to import. The element type can be:
    • Primitive value types: @code:byte, @code:short, @code:int, @code:long, @code:float, @code:double, @code:boolean.
    • Nullable primitives: java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Float, java.lang.Double, java.lang.Boolean, java.lang.String, CalcError, Classic date and time types: java.util.Date, java.util.Calendar, JSR310 date and time types: java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime, java.time.OffsetTime, java.time.OffsetDateTime, java.time.ZonedDateTime, java.time.Instant, java.time.YearMonth, java.time.Year, java.time.MonthDay. (Note: java.time.Duration and java.time.Period are not supported at this time)
    • Custom objects: objects that have public get methods (properties in Kotlin) to be mapped to cell values.
    • %java.util.Map<K, V>% where the key is java.lang.String: It will be treated as a collection of property names and values.
    The collection type can be:
    • Flat (non-jagged, 1D in total) java.lang.Iterable<T> or array.
    • Jagged 2D array where the element type of the inner collection is primitive or nullable primitive.
    options
    The import options.
    Exceptions
    ExceptionDescription
    The data type of column is inconsistent. Use com.grapecity.documents.excel.DataImportOptions.setItemTypeProvider(java.util.function.Function{java.lang.Object,java.lang.Class{?}}) to fix it.
    An item is of an unsupported type or @code:options contains incorrect information.
    See Also