I want to export/transfer files to Google drive using Magento 2. Please help me out.
You can implement following code in your Magento 2 custom extension. Note that you need to convert it according to Magento 2 extension structure and coding standard.
Which file? When you want to upload file on google drive? Is there any specific case ?
So basically you need to use PHP code only to export to the google drive. You need Magento logic just to get the input for google drive API. (File Export)
If there is any specific case like once customer place the order some file has to upload to google drive then you can use
If any some other case you should first find out the place where you can be added the PHP code in the respective
Assuming you have a CSV file to upload : Reference
$fileMetadata = new Google_Service_Drive_DriveFile(array( 'name' => 'My Report', 'mimeType' => 'application/vnd.google-apps.spreadsheet')); $content = file_get_contents('files/report.csv'); $file = $driveService->files->create($fileMetadata, array( 'data' => $content, 'mimeType' => 'text/csv', 'uploadType' => 'multipart', 'fields' => 'id')); printf("File ID: %s\n", $file->id);