Google 表格支持哪些数据类型?

What data types does Google Sheets support?

我无法在线或在表格文档中找到此问题的答案。 Google 表格中的单个单元格支持哪些数据类型?

例如,这是我目前看到的:

是否有 Google 表格接受的可接受数据类型列表?

像你一样,我无法找到明确的数据类型列表。但是,通过个人经验和测试,我验证了 Google sheets 支持以下数据类型:

  • 十进制(,也用于表示整数)
  • 双精度浮点数
  • 字符串(最大长度:50,000 个字符)
  • 布尔值(真和假)
  • 错误代码(例如#N/A、#DIV/0! 和#REF!)

注意:日期、时间和日期时间存储为小数。

数组也可以在 Google 表格中使用。数组的行为类似于它们在 Excel 中的行为方式,但表格不会限制用户编辑数组 the way that Excel does.

中的单元格

关于小数与双精度的注意事项: 重要的是要注意:小数只是 15 位整数,可以在 617 个位置之一有一个小数点;底层数据结构使用整数。另一方面,Double 遵循 IEEE 754 双精度浮点数的定义,在计算过程中容易丢失精度。

一个很好的推论是 Date、Time 和 Datetime 被表示,并且可以被处理为数字(我不知道是 Decimal 还是 FP)。在这种情况下,日期表示为整数部分,表示为自 1899 年 12 月 31 日以来的天数,时间表示为小数部分。

根据 Google 表格 API v4 (ref),单元格值可能是(强调我的):

ExtendedValue

The kinds of value that a cell in a spreadsheet can have.

  • numberValue number

    Represents a double value. Note: Dates, Times and DateTimes are represented as doubles in "serial number" format.

  • stringValue string

    Represents a string value. Leading single quotes are not included. For example, if the user typed '123 into the UI, this would be represented as a stringValue of "123" .

  • boolValue boolean

    Represents a boolean value.

  • formulaValue string

    Represents a formula.

  • errorValue object( ErrorValue )

    Represents an error. This field is read-only.

根据TYPE函数的documentation

  • 人数
  • 文字
  • 布尔值
  • 错误
  • 数组
  • 其他