如何获取单元格的命名范围?
How do I get the named range for a cell(s)?
gdata 和 google 工作表 api 的新功能。我有一项服务,允许用户将电子表格上传到我们的网站,其中包含有关他们的信息:邮政编码、姓名、城市等。电子表格没有定义的格式。相反,我们选择让用户为信息定义命名范围。例如,他们将邮政编码放在名为 "zip_code" 的单元格中,等等。然后我如何访问命名范围?我使用单元格 B3 进行了快速测试并将其命名为 "zip_code"。我可以访问 B3 的数据,但我在任何地方都找不到 "zip_code":
cells = gd_client.GetCellsFeed(key, worksheet_id, 'R3C2')
returns:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:entry xmlns:ns0="http://www.w3.org/2005/Atom" xmlns:ns1="http://schemas.google.com/spreadsheets/2006">
<ns0:category scheme="http://schemas.google.com/spreadsheets/2006" term="http://schemas.google.com/spreadsheets/2006#cell" />
<ns0:id>https://spreadsheets.google.com/feeds/cells/1ElzAH0s_sO3VaEGi2Z8scrX-5ML9614lMjOVQFSIa3/od6/private/full/R3C2</ns0:id>
<ns0:content type="text">10001</ns0:content>
<ns0:title type="text">B3</ns0:title>
<ns1:cell col="2" inputValue="10001" row="3">10001</ns1:cell>
<ns0:link href="https://spreadsheets.google.com/feeds/cells/1ElzAH0s_sO3VaEGi2Z8scrX-5ML9614lMjOVQFSIa3/od6/private/full/R3C2" rel="self" type="application/atom+xml" />
<ns0:link href="https://spreadsheets.google.com/feeds/cells/1ElzAH0s_sO3VaEGi2Z8scrX-5ML9614lMjOVQFSIa3/od6/private/full/R3C2/h30473" rel="edit" type="application/atom+xml" />
<ns0:updated>2015-01-24T16:06:08.280Z</ns0:updated>
</ns0:entry>
如何获取单元格的命名范围?
不可能
据我所知不可能。我经常使用 API,仅支持单元格 formulas/values 的 read/write,据我所知没有别的。没有 "Style" 信息或命名范围等
解决方法
如果您需要解决方法,可以使用 Google-apps-script 获取命名范围。
HTML 服务可能是最好的方式。
Ethercalc
或者您始终可以使用 Ethercalc,一种开源 google-docs 样式的电子表格。
gdata 和 google 工作表 api 的新功能。我有一项服务,允许用户将电子表格上传到我们的网站,其中包含有关他们的信息:邮政编码、姓名、城市等。电子表格没有定义的格式。相反,我们选择让用户为信息定义命名范围。例如,他们将邮政编码放在名为 "zip_code" 的单元格中,等等。然后我如何访问命名范围?我使用单元格 B3 进行了快速测试并将其命名为 "zip_code"。我可以访问 B3 的数据,但我在任何地方都找不到 "zip_code":
cells = gd_client.GetCellsFeed(key, worksheet_id, 'R3C2')
returns:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:entry xmlns:ns0="http://www.w3.org/2005/Atom" xmlns:ns1="http://schemas.google.com/spreadsheets/2006">
<ns0:category scheme="http://schemas.google.com/spreadsheets/2006" term="http://schemas.google.com/spreadsheets/2006#cell" />
<ns0:id>https://spreadsheets.google.com/feeds/cells/1ElzAH0s_sO3VaEGi2Z8scrX-5ML9614lMjOVQFSIa3/od6/private/full/R3C2</ns0:id>
<ns0:content type="text">10001</ns0:content>
<ns0:title type="text">B3</ns0:title>
<ns1:cell col="2" inputValue="10001" row="3">10001</ns1:cell>
<ns0:link href="https://spreadsheets.google.com/feeds/cells/1ElzAH0s_sO3VaEGi2Z8scrX-5ML9614lMjOVQFSIa3/od6/private/full/R3C2" rel="self" type="application/atom+xml" />
<ns0:link href="https://spreadsheets.google.com/feeds/cells/1ElzAH0s_sO3VaEGi2Z8scrX-5ML9614lMjOVQFSIa3/od6/private/full/R3C2/h30473" rel="edit" type="application/atom+xml" />
<ns0:updated>2015-01-24T16:06:08.280Z</ns0:updated>
</ns0:entry>
如何获取单元格的命名范围?
不可能
据我所知不可能。我经常使用 API,仅支持单元格 formulas/values 的 read/write,据我所知没有别的。没有 "Style" 信息或命名范围等
解决方法
如果您需要解决方法,可以使用 Google-apps-script 获取命名范围。 HTML 服务可能是最好的方式。
Ethercalc
或者您始终可以使用 Ethercalc,一种开源 google-docs 样式的电子表格。