L2 Construct: upload_file
drive googleDescription
UploadFile uploads a file to Google Drive. It takes the following inputs:
- file_name: The name of the file to upload
- file_type: The type of file to upload. Supported types: sheet, doc, slides, xlsx, docx, pptx, csv, pdf, txt, png, jpg, jpeg, gif, bmp, tiff, webp
- file_data: The data to upload (as a base64-encoded string of a byte array)
- folder_id: The ID of the folder to upload the file to (optional).
L2 Data
- Provider: google
- Module: gdrive
- Action: upload_file
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "google",
"module": "gdrive",
"action": "upload_file",
"metadata": {}
}
}
Input
Example
{
"file_name": "Monthly_Report_For_2024_Template",
"file_type": "sheet",
"file_data": "Sheet data in CSV format",
"folder_id": "1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc"
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gdrive/upload-file-input",
"$ref": "#/$defs/UploadFileInput",
"$defs": {
"UploadFileInput": {
"properties": {
"file_name": {
"type": "string"
},
"file_type": {
"type": "string"
},
"file_data": {
"type": "string"
},
"folder_id": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": ["file_name", "file_type", "file_data"]
}
}
}
Output
Example
{
"file_id": "1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc",
"file_name": "Monthly_Report_For_2024_Template",
"file_type": "",
"file_url": "https://drive.google.com/file/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/view?usp=drive_link",
"error": {
"is_error": false
}
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gdrive/upload-file-output",
"$ref": "#/$defs/UploadFileOutput",
"$defs": {
"HandlerError": {
"properties": {
"is_error": {
"type": "boolean"
},
"errors": {
"items": {
"type": "string"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["is_error"]
},
"UploadFileOutput": {
"properties": {
"file_id": {
"type": "string"
},
"file_name": {
"type": "string"
},
"file_type": {
"type": "string"
},
"file_url": {
"type": "string"
},
"error": {
"$ref": "#/$defs/HandlerError"
}
},
"additionalProperties": false,
"type": "object",
"required": ["file_id", "file_name", "file_type", "file_url", "error"]
}
}
}