我可以使用google drive api上传受密码保护的pdf吗?

So i've tried uploading a normal non password protected pdf file and it successfully gets uploaded using the below code. However if i try the same with a password protected file google throws a 400 error code (Bad Request) refrence: https://developers.google.com/drive/api/v3/reference/files/create

 $content = file_get_contents($file_path);
 $fileMetadata = new Google_Service_Drive_DriveFile(array(
                        'name' => 'dummy_name',
                        'mimeType' => 'application/vnd.google-apps.spreadsheet'));

 $file = $service->files->create($fileMetadata, array(
                        'data' => $content,
                        'mimeType' => 'application/pdf',
                        'uploadType' => 'multipart',
                        'fields' => 'id'));

Is it possible to upload a pdf with password protection even if i have the password with me?

You seem to have the mimeType set to "application/vnd.google-apps.spreadsheet". I think it should work if you set it to "application/pdf"

In my case, password protected file upload seems to work with PDFs, but not with DOCX files.