hey, I have a question about the upload funktion that I made. It is written in python and can upload files to drive, but I need to use the access token as Verifcation in it. However, as we all know the acess token stops working after one hour. Is there a way to automaticly refresh this token in the script, maybe with an variable and the refresh token? Thanks for your helping Content!
@DaimtoAps3 жыл бұрын
If you request offline access you should get a refresh token. The python client library should be able to handle refreshing the access token for you.
@nichlaus Жыл бұрын
Hello... What should I change for the code to download all the text files in the folder?
@DaimtoAps Жыл бұрын
you should do a file.list with q parameter and search for text files. Then do a file.get on each file to download it.
@brucelittle32482 жыл бұрын
Can this be used in a Team Drive environmnet? I've now tested the Service Account granted us by our IT department on my personal (within work domain) drive and it does log in and return results. HOWEVER, if I try to retrieve files from a Shared Drive (and set the IncludeItemsFromAllDrives and SupportsAllDrives parameters on the request to true), it doesn't return an error, but it also returns no files or folders (and there are thousands on the Shared Drive). Are there other parameters that need to be set in order for it to return files from a Shared Drive?
@DaimtoAps2 жыл бұрын
Teams is workspace isn't it? check domain wide deligation
@brucelittle32482 жыл бұрын
@@DaimtoAps Domain was fine. I tested it by modifying it to look at my personal drive (within the organization's Drive envirnoment) and it worked fine. HOWEVER -- the syntax in the Q parameter appears to be different for team drives. I found a Python example where they had "'' in parents" rather than "parents in ''". Changing it to this syntax worked. I'm not sure why there would be a discrepency in syntax between personal and Workspace Shared drives, but this appears to have been the issue. Also, the IncludeItemsFromAllDrives and SupportsAllDrives request parameters are 'false' by default and need to be set to 'true'.
@michellemontgomery56782 жыл бұрын
Hey Linda! So I'm trying to download a file via export but the mimeType returned by get() isn't the same as what export expects so it says there is an error with file conversion. The file is a document created on Google Drive. The mimeType returned by get() is application/vnd.google-apps.document but export fails because it wants application/vnd.oasis.opendocument.text. I'm using the PHP api library. If you do an about request I see the JSON results with application/vnd.google-apps.document as a key to an array that contains application/vnd.oasis.opendocument.text. I want the file download mimeType to be automated. Any insight or recommendations? Thanks! :)
@DaimtoAps2 жыл бұрын
oh good question! can you put this on stack overflow with your code I would love to test this!
@sanskarrawat27502 жыл бұрын
Hey, I have written my code using user account. But I want to run code on virtual machine so now I am making service account. But I couldn't find how to use service account in java and how can I access files through that service account. Please help me in this.
@DaimtoAps2 жыл бұрын
I don't have any java samples but I can definitely put something together
@osanbrazil999 Жыл бұрын
How can I retrieve a directory's id by its name? e.g: I want to search files in a specific folder that I created in google drive, but I only have the name.
@DaimtoAps Жыл бұрын
use file.list with the q parametre to Search by name and folder mime type
@GauravGurjar2 жыл бұрын
Can we download the files from multiple parent folders? For example, 2022 Folder > January > 01142022.csv 2022 Folder > February > 02142022.csv I have 2022 (year) as a grandparent and January(month) as a parent folder and 02142022.csv as child file. how to download the files every month which arrives every month. I can only give the folder id of 2022 hard-coded and month-based folder id has to be taken up automatically. Please guide.
@DaimtoAps2 жыл бұрын
your going to have to do it one at a time.
@StudentCompanion3 жыл бұрын
Thanks for the great video
@DaimtoAps3 жыл бұрын
hope I was able to help
@hernanrodriguezcatalano99973 жыл бұрын
can you export folders with all your files inside?
@DaimtoAps3 жыл бұрын
Sadly not in a single call, you will need to loop over each file and download them one at a time.
@rimeddahoumi43812 жыл бұрын
Thanks Linda for this great explaination ! So i would ask where can i find this script within the video 🙏🙏
@DaimtoAps2 жыл бұрын
Check the description I normally put up a companion blog post on my website with the code. www.daimto.com/google-drive-api-with-a-service-account/ Plan is to have a Patron account where I can give them access to full working samples. Something for the future.
@rimeddahoumi43812 жыл бұрын
@@DaimtoAps thank u very much Linda❤❤
@CarlosDiaz-tz6ov2 жыл бұрын
Is there a way to export a specific file with the name?
@DaimtoAps2 жыл бұрын
No you will need to find that file.id, do a file.list and search for it
@abobrhom73 жыл бұрын
System.InvalidOperationException: 'Error creating credential from JSON. Unrecognized credential type .' I chose Desktop App as application type for the service account
@DaimtoAps3 жыл бұрын
you should create service account credentials not desktop credentials
@abobrhom73 жыл бұрын
@@DaimtoAps solved it days ago. Thank you
@mehmetalioran27212 жыл бұрын
var response = await request.ExecuteAsync(); error is here
@DaimtoAps2 жыл бұрын
is your method set to async? what's your error?
@softfiscalpb6743 жыл бұрын
Obrigado por compartilhar.
@mehmetalioran27212 жыл бұрын
error? Severity Code Description Project File Line Suppression State Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. gdrv2 c:\users\oran\documents\visual studio 2015\Projects\gdrv2\gdrv2\Program.cs 35 Active
@DaimtoAps2 жыл бұрын
add async to your method declination
@germanlopez86492 жыл бұрын
Amazing video! Greetings from Honduras!!! , but I'm having an error Unhandled exception. The service drive has thrown an exception. HttpStatusCode is BadRequest. Google.Apis.Requests.RequestError Invalid Value [400] Errors [ Message[Invalid Value] Location[q - parameter] Reason[invalid] Domain[global] ] Google.GoogleApiException: The service drive has thrown an exception. HttpStatusCode is BadRequest. Invalid Value Line Code: var responseSheet = await requestSheet.ExecuteAsync();
@DaimtoAps2 жыл бұрын
open a question on stack overflow if you want I will have a look