Add and Retrieve Data

Adding Data to Cells

Aspose.Cells provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a WorksheetCollection that allows access to each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a Cells collection. Each item in the Cells collection represents an object of the Cell class.

Aspose.Cells allows developers to add data to cells in worksheets by calling the Cell class' setValue property. By using the setValue property, it is possible to add Boolean, string, double, integer or date/time, etc. values to the cell.

Improving Efficiency

While working on worksheets, users may add different types of data in the cells. These data items may include boolean, integer, floating-point, text or date/time values. You can get the appropriate values from the cells according to their data types using Aspose.Cells.

Retrieving Data from Cells

Aspose.Cells provides a class, Workbookthat represents an Excel file. Workbook class contains a WorksheetCollection that allows access to each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a Cells collection. Each item in the Cells collection represents an object of the Cell class.

The Cell class provides several properties that allow developers to retrieve values from the cells according to their data types. These properties include:

Moreover, the type of data contained in a cell can also be checked by using the Type property of the Cell class. In fact, the Cell class' Type property is based on CellValueType enumeration whose pre-defined values are listed below:

Cell Value Types Description
IS_BOOL Specifies that the cell value is Boolean.
IS_DATE_TIME Specifies that the cell value is date/time.
IS_ERROR Represents that the cell contains an error value
IS_NULL Represents a blank cell.
IS_NUMERIC Specifies that the cell value is numeric.
IS_STRING Specifies that the cell value is a string.
IS_UNKNOWN Specifies that the cell value is unknown.
You can also use the above pre-defined cell value types to compare with the type of the data present in each cell.