I’ve encountered a similar issue before. The problem likely stems from using a service account, which operates independently from your personal Google account. When you upload files with a service account, they’re stored in that account’s Drive, not your personal one.
To resolve this, you have a couple options:
Share the service account’s email (found in your JSON file) with your personal Google account, granting it access to the uploaded files.
Use the drive.files().create() method with the ‘parents’ parameter to specify a folder ID where you want the files to appear. Ensure this folder is shared with both your personal account and the service account.
Remember, service accounts are designed for server-to-server interactions, so this behavior is actually by design. If you’re developing a personal tool, you might want to consider using OAuth 2.0 instead for a more seamless experience with your personal Drive.
I’ve dealt with this exact problem before, and it can be pretty frustrating. The key thing to understand is that service accounts have their own separate Google Drive storage. When you upload files using a service account, they’re going into that account’s Drive, not your personal one.
Here’s what worked for me:
I created a folder in my personal Google Drive and shared it with the service account email (you can find this in your JSON file).
Then I modified my Python script to specify this shared folder as the parent when uploading. You can do this by adding a ‘parents’ field to your metadata dict:
hey alice, i had this issue too. the files are probably in the service account’s drive, not yours. try sharing the service account email (in the JSON file) with ur google account. or use ‘parents’ parameter in create() to put files in a shared folder. good luck!