Google Sheets API v4 和 valueInputOption [英] Google Sheets API v4 and valueInputOption

查看:29
本文介绍了Google Sheets API v4 和 valueInputOption的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的电子表格中有三列.第一个是日期,第二个和第三个是简单的字符串.

I have three columns in my spreadsheet. The first one is date, the second and the third are simple strings.

当我批量上传数据时 valueInputOption = "RAW" 我的日期列得到错误的结果.所有日期前面都有一个不可见的撇号.字符串列没问题.

When I do batch upload of my data valueInputOption = "RAW" I get a wrong result for my Date column. All dates have an invisible apostrophe before them. String columns are OK.

当我使用 valueInputOption = "USER_ENTERED" 时,所有日期都很好,但其他值不会被解释为实际值,而是被解释为 Google 解析的值.例如,字符串2-3-4"将表示为 02/04/2004 或类似的内容.

When I use valueInputOption = "USER_ENTERED" all dates are good, but other values are interpreted not as actual values but as Google parsed values. For example a string "2-3-4" will be represented as 02/04/2004 or something like that.

我希望数据列表示为 USER_ENTERED,字符串列表示为 RAW.

I want data column to be represented as USER_ENTERED and string columns as RAW.

有没有办法为单元格(列)设置valueInputOption?

Is there any way to set valueInputOption for a cell (column)?

推荐答案

我找到了答案.

为了使所有需要的数据都表示为字符串,您应该:

In order to make all needeed data to be represented as string, you should:

  • 设置 valueInputOption = USER_ENTERED;
  • 在它前面加上撇号,就像这个'.

在这种情况下,其他列类型将根据 Google 自己的算法自动确定,并且带有 ' 符号的单元格的列将完全按照您输入的方式显示

In this case other columns type will be determined automatically based on Google's own algorithms and columns with cells prepended with ' sign will be shown exactly as you enteren them

当所有电子表格列都设置了自动类型时,它会起作用.不确定对于其他格式类型的列会发生什么.

It works when all spreadsheet columns have Automatic type set. Not sure what will happen for colums with other format types.

这篇关于Google Sheets API v4 和 valueInputOption的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆