I
I
Ilya Kochkin2019-12-10 09:23:16
Google
Ilya Kochkin, 2019-12-10 09:23:16

How to copy file using google drive api?

Please tell me how to copy a file from google drive to google drive using api
using the "google / apiclient" library: "2.x-dev" when executing the script, there are no errors
in the console, everything is ok too - but the file is not copied in my googledrive, I don’t have it see what I'm doing wrong? cloud.googleofKbepJB4hc.jpg

$api_conf = 'google/key.json';
         $client = new Google_Client();
         $client->setAuthConfig($api_conf);
         $client->setScopes(array(Google_Service_Sheets::DRIVE, Google_Service_Sheets::SPREADSHEETS));

         $service = new Google_Service_Drive($client);

         $body = new Google_Service_Drive_DriveFile();
         $body->setName('test');
         $body->setMimeType("application/vnd.google-apps.spreadsheet");
        var_dump($service->files->copy("1Yp0IgFOo4qOgy-6BDuDgZXWe_eF7lu4Q7k1dV6JXtMUsfd", $body));

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question