1 回答
TA贡献1906条经验 获得超3个赞
您应该遵循PHP 快速入门,因为它正是您想要的。
如果你想跳过第一行,只需使用$range = 'A2:E';
代码片段:
$client = getClient();
$service = new Google_Service_Sheets($client);
$spreadsheetId = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms';
$range = 'Class Data!A2:E';
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
$values = $response->getValues();
if (empty($values)) {
print "No data found.\n";
}else{
var_dump($values);
}
输出:
array(30) {
[0]=>
array(5) {
[0]=>
string(9) "Alexandra"
[1]=>
string(6) "Female"
[2]=>
string(9) "4. Senior"
[3]=>
string(2) "CA"
[4]=>
string(7) "English"
}
[1]=>
array(5) {
[0]=>
string(6) "Andrew"
[1]=>
string(4) "Male"
[2]=>
string(11) "1. Freshman"
etc...
- 1 回答
- 0 关注
- 102 浏览
添加回答
举报