Automated file upload to Google Drive without user interaction?

I’m trying to create a server app that can automatically upload files to Google Drive without any user interface. Here’s what I need:

  • Upload Word, Excel, and other file types
  • Run as a command-line tool
  • Work with cron jobs or similar scheduling
  • No human input required
  • No web-based OAuth flow

I used to use the Documents List API, but it’s now deprecated. The Google Drive API seems to need a web/OAuth process, which won’t work for my automated setup.

Is there a way to do this with a current, supported Google API? I want to avoid using deprecated stuff that might stop working soon.

Has anyone figured out how to do automated Google Drive uploads without any UI? What’s the best approach for this kind of server-side, scheduled file upload task?

I’ve been working on a similar project, and I can confirm that service accounts are the way to go for automated uploads to Google Drive. Here’s what worked for me:

First, set up a service account in Google Cloud Console and download the JSON key. Then, use the Google Drive API v3 with a language-specific client library (I used Python, but there are others available).

In your code, load the service account credentials and initialize the Drive API client. You can then use the files().create() method to upload files programmatically. Make sure to set the proper MIME types for different file formats.

For scheduling, I use cron jobs on Linux, but you could also use Windows Task Scheduler if you’re on that platform. Just call your script at the desired intervals.

One tip: store your service account key securely and don’t hardcode any sensitive info in your script. Also, remember to share the target folder with the service account’s email address to grant access.

This approach has been reliable for me, with no user interaction needed once it’s set up.

hey, i’ve done smth similar before. you can use service accounts for this. they let u authenticate without user interaction. create one in google cloud console, download the json key, n use it in ur code. google’s python client library makes it easy. hope this helps!

I’ve implemented a similar solution for automated Google Drive uploads, and service accounts are indeed the proper choice for headless operations. I began by setting up a project in the Google Cloud Console, enabling the Drive API, and creating a service account from which I downloaded the credentials. I then incorporated these credentials into my code for authentication. In my experience, using libraries such as google-auth and google-auth-oauthlib along with the Drive API client facilitates smooth integration with scheduled tasks. It is essential to grant the appropriate permissions to the service account for the target folder so that automated uploads operate without interruption.