使用Zend将工作表添加到PHP的Google电子表格中

时间:2012-01-04 13:47:42

标签: google-sheets zend-framework worksheet

如何使用Zend将工作表添加到Google文档电子表格?

谢谢!

1 个答案:

答案 0 :(得分:1)

这个不容易理解,这是适合我的代码(感谢articleZend Framework Quick Reference

// Connection & spreadsheet API
$client = Zend_Gdata_ClientLogin::getHttpClient('you@there.com', 'sunshine-', Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME);
$service = new Zend_Gdata_Spreadsheets($client);

// Get worksheet feed
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey('your spreadsheet key');
$feed = $service->getWorksheetFeed($query);

// Create new worksheet structure
$newWorksheet = new Zend_Gdata_Spreadsheets_WorksheetEntry();
$newWorksheet->setTitle(new Zend_Gdata_App_Extension_Title("My Brillant New Worsheet", null));
$newWorksheet->setRowCount(new Zend_Gdata_Spreadsheets_Extension_RowCount(10));
$newWorksheet->setColumnCount(new Zend_Gdata_Spreadsheets_Extension_ColCount(10));

// Add new worksheet to worksheets feed
$service->insertEntry($newWorksheet->saveXML(), $feed->getLink('self')->getHref());