繁体   English   中英

在google-api-php-client中使用importTable()导入FusionTable

[英]import a fusiontable using importTable() in google-api-php-client

我想使用可以在GitHub https://github.com/google/google-google-api-php-client上找到的Google API客户端库以编程方式导入Google Fusion Table。 它包含一个服务类Fusiontables.php,该类具有一个功能importTable(),显然可以完成我喜欢的事情。

/**
* Imports a new table. (table.importTable)
*
* @param string $name The name to be assigned to the new table.
* @param array $optParams Optional parameters.
*
* @opt_param string delimiter The delimiter used to separate cell values. This
* can only consist of a single character. Default is ,.
* @opt_param string encoding The encoding of the content. Default is UTF-8. Use
* auto-detect if you are unsure of the encoding.
* @return Google_Service_Fusiontables_Table
*/
public function importTable($name, $optParams = array())
{
  $params = array('name' => $name);
  $params = array_merge($params, $optParams);
  return $this->call('importTable', array($params), "Google_Service_Fusiontables_Table");
}

该函数读起来很简单,尽管我无法弄清楚如何用实际数据(可能是从CSV文件中提取)来提供数据。

我在这里找到了关于另一个函数importRows()的最新答案: Google PHP API客户端和融合表:如何使用importRows? 它说明了如何使用optParams数组键'data'将实际数据作为逗号分隔列表插入。 首先,函数注释中未描述所有使用的参数,那么在哪里可以找到好的文档? 其次,我不清楚如何指定由几行组成的数据(因为函数名称读取的是“行”的复数形式)。

希望找到有关此Google API PHP客户端库的专家。

  1. PHP函数的“标准参数”未在相关的PHP客户端函数方法中详述。

  2. importRows导入的数据的一般格式为CSV。 因此,要指定多行,输入blob中的行应由适当的换行符分隔。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM