pub struct Cell {
pub column_id: u64,
pub column_type: Option<String>,
pub conditional_format: Option<String>,
pub hyperlink: Option<Hyperlink>,
pub value: Option<CellValue>,
pub display_value: Option<String>,
pub object_value: Option<Value>,
pub format: Option<String>,
pub formula: Option<String>,
pub image: Option<Image>,
pub override_validation: Option<bool>,
pub strict: Option<bool>,
}
Fields§
§column_id: u64
The Id of the column that the cell is located in.
column_type: Option<String>
Only returned if the include query string parameter contains
columnType
.
conditional_format: Option<String>
The format descriptor describing this cell’s conditional format. Only
returned if the include query string parameter contains format
and
this cell has a conditional format applied.
hyperlink: Option<Hyperlink>
Represents a hyperlink to a dashboard, report, sheet, or URL.
In the most common scenario, the hyperlink is a URL link, and the url
property contains the URL value. This can more easily be retrieved
via the Cell.link_url
method.
§More info
- https://smartsheet-platform.github.io/api-docs/#hyperlinks
- https://smartsheet-platform.github.io/api-docs/#hyperlink-object
value: Option<CellValue>
Cell.value
represents a cell’s raw value and can be one of the
following primitive JSON types: string, number, or Boolean, depending
on the column type. An empty cell returns no value.
§More info
- https://smartsheet-platform.github.io/api-docs/#cell-reference
display_value: Option<String>
Cell.displayValue
is always a string and is only returned for certain
column types. It represents the formatted value as it should be
displayed to an end-user.
§Examples
If a TEXT_NUMBER column is formatted as a US Dollar currency, its value may be a number like 1234.5678, but its displayValue is “$1,234.57”.
§More info
- https://smartsheet-platform.github.io/api-docs/#cell-reference
object_value: Option<Value>
Cell.objectValue
is an object representation of a cell’s value and
is currently used for adding or updating predecessor cell values, or
for multi-contact details, such as email addresses.
§More info
- https://smartsheet-platform.github.io/api-docs/#cell-reference
format: Option<String>
The format descriptor. Only returned if the include query string
parameter contains format
and this cell has a non-default format
applied.
formula: Option<String>
The formula for a cell, if set, for instance =COUNTM([Assigned To]3).
Note that calculation errors or problems with a formula do not cause
the API call to return an error code. Instead, the response contains
the same value as in the UI, such as
cell.value = "#CIRCULAR REFERENCE"
.
image: Option<Image>
Cell Image object
override_validation: Option<bool>
(Admin only) Indicates whether the cell value can contain a value
outside of the validation limits (value = true). When using this
parameter, you must also set strict
to false to bypass value
type checking. This property is honored for POST or PUT actions that
update rows.
strict: Option<bool>
Set to false to enable lenient parsing. Defaults to true. You can specify this attribute in a request, but it is never present in a response.
Implementations§
Source§impl Cell
impl Cell
pub fn with_strict(self, strict: bool) -> Cell
Sourcepub fn value_as_str(&self) -> Result<&str, Box<dyn Error + Send + Sync>>
pub fn value_as_str(&self) -> Result<&str, Box<dyn Error + Send + Sync>>
Retrieve the Cell value
as a string
Sourcepub fn value_as_str_safe(&self) -> Option<&str>
pub fn value_as_str_safe(&self) -> Option<&str>
Retrieve the Cell value
as a string, but prefer to use an
Option
implementation instead, which can be unwrap
ped.
Sourcepub fn value_as_number(&self) -> Result<&Number, Box<dyn Error + Send + Sync>>
pub fn value_as_number(&self) -> Result<&Number, Box<dyn Error + Send + Sync>>
Retrieve the Cell value
as a Number
Sourcepub fn value_as_bool(&self) -> Result<bool, Box<dyn Error + Send + Sync>>
pub fn value_as_bool(&self) -> Result<bool, Box<dyn Error + Send + Sync>>
Retrieve the Cell value
as a boolean
Sourcepub fn value_as_u64(&self) -> Result<u64, Box<dyn Error + Send + Sync>>
pub fn value_as_u64(&self) -> Result<u64, Box<dyn Error + Send + Sync>>
Retrieve the Cell value
as an unsigned integer
Sourcepub fn value_as_f64(&self) -> Result<f64, Box<dyn Error + Send + Sync>>
pub fn value_as_f64(&self) -> Result<f64, Box<dyn Error + Send + Sync>>
Retrieve the Cell value
as a float
Sourcepub fn display_value_as_str(&self) -> Result<&str, Box<dyn Error + Send + Sync>>
pub fn display_value_as_str(&self) -> Result<&str, Box<dyn Error + Send + Sync>>
Retrieve the Cell display_value
as a string
Sourcepub fn display_value_as_str_safe(&self) -> Option<&str>
pub fn display_value_as_str_safe(&self) -> Option<&str>
Retrieve the Cell display_value
as a string, but prefer to use an
Option
implementation instead, which can be unwrap
ped.
Sourcepub fn link_url(&self) -> Result<&str, Box<dyn Error + Send + Sync>>
pub fn link_url(&self) -> Result<&str, Box<dyn Error + Send + Sync>>
Retrieve the Cell hyperlink
URL as a string
Sourcepub fn link_url_safe(&self) -> Option<&str>
pub fn link_url_safe(&self) -> Option<&str>
Retrieve the Cell hyperlink
URL as a string, but prefer to use an
Option
implementation instead, which can be unwrap
ped.
Sourcepub fn values(&self) -> Result<&Vec<Value>, Box<dyn Error + Send + Sync>>
pub fn values(&self) -> Result<&Vec<Value>, Box<dyn Error + Send + Sync>>
Get the underlying list of values of the object_value
. This assumes
that the objectType
is either MULTI_PICKLIST or MULTI_CONTACT.
For more info, refer to the ObjectValue object.
Sourcepub fn contacts(
&self,
) -> Result<Vec<ContactOwned>, Box<dyn Error + Send + Sync>>
pub fn contacts( &self, ) -> Result<Vec<ContactOwned>, Box<dyn Error + Send + Sync>>
Retrieve info on a cell for a MULTI_CONTACT column. This returns a list
containing a ContactOwned
object for each contact in the cell.
You can then get additional info from the returned result, such as via
the addrs_str()
method for instance.
Check out the cell_multi_contact
example for intended usage with
this method.