How to Auto-Organize Employee Documents in Folders & Sync with Google Drive

Hello Frappe Community,

I need help implementing a document management system in Frappe for employee records. The requirement is as follows:

  1. In the Employee List, under each employee’s profile, there should be a Documents tab where employees can upload their documents.
  2. There will be three document categories:
  • Aadhar Card
  • PAN Card
  • Resume
  1. When an employee uploads a document, the system should:
  • Automatically create a folder in the File List based on the employee code.
  • Store the uploaded file in a corresponding subfolder within that employee’s folder based on the document type.
    Follow this file storage structure:

Employee Code > Document Type > Uploaded File
Example: 07620 > Aadhar Card > Uploaded File

  1. Additionally, the same structure should be mirrored in Google Drive, ensuring that the uploaded documents are stored in Drive under:
Employee Code > Document Type > Uploaded File  

Questions:

  1. How can I dynamically create folders in the File List when a document is uploaded?
  2. What would be the best approach to automatically create subfolders based on document type?
  3. How can I integrate this with Google Drive and ensure the same structured storage format?
  4. Are there any existing Frappe APIs or scripts that can help automate this process?