Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.
Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin. Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

google spreadsheet API bilan ishlashda muommo

0 ovoz
26 marta ko‘rilgan
so‘radi 31 dekabr, 19 parmonov98 (1,581 bal)

<?php

// include your composer dependencies

require_once 'vendor/autoload.php';

session_start();

$client = new \Google_Client();

$client->setApplicationName('My PHP App');

$client->setScopes([\Google_Service_Sheets::SPREADSHEETS]);

$client->setAccessType('offline');

$client->setAuthConfig('credentials.json');

$sheets = new Google_Service_Sheets($client);

$spreadsheetId = '1gkj73sum5I6nxe3u5N8qWFKfD242RGFoxr2GFWg9l3U';

$spreadsheetId = '1gkj73sum5I6nxe3u5N8qWFKfD242RGFoxr2GFWg9l3U';

$spreadsheetId2 = '1XrgftW2aOgGq6PJUCXZu6c0G8N4pzK-VM6r-KBL4okI';

$sheetId = '1507337286';

// TODO: Assign values to desired properties of `requestBody`:

$requestBody = new Google_Service_Sheets_CopySheetToAnotherSpreadsheetRequest();

$response = $sheets->spreadsheets_sheets->copyTo($spreadsheetId, $sheetId, $requestBody);

// TODO: Change code below to process the `response` object:

echo '<pre>', var_export($response, true), '</pre>'"\n";

Men nima qimoqchiman, bitta google spreadsheetning  bitta sheetini ikkinchisiga nusxalamoqchiman. 

https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.sheets/copyTo

quyidagi method orqali nima narsa neto ketyapti shunga tushunmayapman. 

chiqayotgan xatolik:

Fatal error: Uncaught Google_Service_Exception: { "error": { "code": 400, "message": "Invalid destinationSpreadsheetId []", "errors": [ { "message": "Invalid destinationSpreadsheetId []", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } in C:\OSPanel\domains\gsheet.lc\vendor\google\apiclient\src\Google\Http\REST.php:118 Stack trace: #0 C:\OSPanel\domains\gsheet.lc\vendor\google\apiclient\src\Google\Http\REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #1 C:\OSPanel\domains\gsheet.lc\vendor\google\apiclient\src\Google\Task\Runner.php(181): Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #2 C:\OSPanel\domains\gsheet.lc\vendor\google\apiclient\src\Google\Http\REST.php(58): Google_Task_Runner->run() #3 C:\OSPanel\domains\gsheet.lc\vendor\google\apiclient\src\Google\Client.php(779): Go in C:\OSPanel\domains\gsheet.lc\vendor\google\apiclient\src\Google\Http\REST.php on line 118

1 ta javob

+1 ovoz
javob berdi 31 dekabr, 19 parmonov98 (1,581 bal)
 
Eng yaxshi javob

$requestBody['destinationSpreadsheetId'] = $spreadsheetId2;

 mana qo'shish kerak ekan. docs ni yaxshi o'qish kerak shunchakimas, balki diqqat bilan!

Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.

Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin.

Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

Telegram kanal YordamUzRss

...