2013-07-19 47 views
2

的谷歌API的PHP客戶端版本0.6.3似乎支持importRows命令:Google PHP API客戶端和Fusion Tables:如何使用importRows?

public function importRows($tableId, $optParams = array()) { 
    $params = array('tableId' => $tableId); 
    $params = array_merge($params, $optParams); 
    $data = $this->__call('importRows', array($params)); 
    if ($this->useObjects()) { 
    return new Google_Import($data); 
    } else { 
    return $data; 
    } 
} 

importRows文件並沒有真正與功能在PHP客戶端已經實現方式一致,因爲沒有按似乎也無法傳遞CSV信息。

有沒有人有任何使用Google API php客戶端0.6.3成功實現importRows的示例代碼?

我有我的實施使用服務帳戶一次輸入一行。顯然,我寧願批量執行,而不是通過'insert'或'sql'循環。

回答

1

我知道這是一個遲到的答覆,但是對於未來的參考,我無論如何都會回答是: 您需要使用uploadTypemime類型數據optParams陣列上

實施例:

importRows([tableId], array(
'uploadType' => 'media' , 
'mimeType' => 'application/octet-stream' , 
'data'=>'1,Moth, 30, 2012') 
); 
相關問題