A powerful and secure Google Drive extension built using Google Apps Script that works like a cloud database. No need for OAuth or Google console setup. Just deploy your script, set your API key and you’re ready to store, update, rename, delete, and manage files or folders!
Features:
- Upload, edit, delete, rename, and read files from Google Drive
- Read file contents directly from Kodular file picker URI
- Obfuscated API key support with
SecureApiKey
Function Blocks
SetScriptUrl(url)
- Sets the URL of your deployed Google Apps Script.
- Use this once to configure the base URL.
SetApiKey(key)
- Set your secret key to authenticate your API calls.
- For production, use
SecureApiKey
instead.
SetFolderId(folderId)
- Set the Google Drive folder ID where files will be created.
- Keep it reusable across multiple actions.
SecureApiKey(encodedKey, level)
- Protect your API key with layered Base64 encryption.
- Call this instead of
SetApiKey
to deter hackers from reverse engineering your app.
CreateFile(name, filePath)
- Upload file content (from URI after file picker) to Google Drive.
- Use this when saving notes, images, or any user-generated content.
EditFile(fileId, filePath)
- Replace content of an existing file with new data from another file.
- Ideal for updating saved documents or logs.
DeleteFile(fileId)
- Soft-deletes (trashes) a file in Drive.
- Recommended when offering delete options to users.
RenameFile(fileId, newName)
- Renames a file using Google Drive API.
- Perfect for user-editable file management systems.
GetFileContent(fileId)
- Downloads file content as string from Drive.
- Can be used to preview text, config, or restore saved files.
GotResponse(response)
- Triggered whenever the extension receives a response from Apps Script.
- Always parse this result to check status or output.
DownloadFile(fileId, saveAsFileName)
- Downloads any file (PDF, image, APK, etc.) from Google Drive
- Saves it to app-specific local storage on the device
- Useful for letting users save backups, restore files, or fetch user-uploaded media
GetDirectDownloadLink(fileId)
- Generates a clean
https://drive.google.com/uc?export=download&id=...
link.- Use this for streaming files in a browser, video player, or direct download.
GetFiles()
- Fetches all files in the current folder.
- Triggers
GotFileList
event with:
![]()
fileNames
→ list of file names![]()
fileSizes
→ file size in bytes![]()
fileUrls
→ download links![]()
lastUpdateDates
→ last modified timestamps![]()
fileIds
→ file IDs for further use
How to Use it with simple Five Step
- Go to Google Apps Script → New Project
- Copy the Apps Script and Set your API key in script
Deploy the Script
- Go to Deploy > Manage Deployments
- Choose Web App
- Execute as: Me
- Who has access: Anyone (with API_KEY check)
- Click Deploy
- Copy the Web App URL
- In Kodular, use
SetScriptUrl
,SetFolderId
, andSecureApiKey
- Start calling
CreateFile
,EditFile
, etc.
Specifications
Package:com.mahir.googledrive.aix (9.6 KB)
Minimum API Level: 7
Updated On: 2025-07-05T18:00:00Z
Version:
2
Built & documented using: FAST-CLI
App Script
ADD YOUR OWN SECRET API KEY
const API_KEY = "your-secret-key";
function doPost(e) {
try {
const data = JSON.parse(e.postData.contents);
if (data.apiKey !== API_KEY) return output({ success: false, error: "Invalid API Key" });
switch (data.action) {
case "create": return createFile(data);
case "edit": return editFile(data);
case "delete": return deleteFile(data);
case "rename": return renameFile(data);
case "get": return getFile(data);
case "download": return downloadFile(data);
case "getlink": return getDirectLink(data);
case "list": return getFiles(data);
default: return output({ success: false, error: "Unknown action" });
}
} catch (e) {
return output({ success: false, error: e.toString() });
}
}
function output(obj) {
return ContentService.createTextOutput(JSON.stringify(obj)).setMimeType(ContentService.MimeType.JSON);
}
function createFile(data) {
const file = DriveApp.getFolderById(data.folderId).createFile(data.name, data.content, "text/plain");
return output({ success: true, fileId: file.getId() });
}
function editFile(data) {
DriveApp.getFileById(data.fileId).setContent(data.content);
return output({ success: true });
}
function deleteFile(data) {
DriveApp.getFileById(data.fileId).setTrashed(true);
return output({ success: true });
}
function renameFile(data) {
DriveApp.getFileById(data.fileId).setName(data.newName);
return output({ success: true });
}
function getFile(data) {
const content = DriveApp.getFileById(data.fileId).getBlob().getDataAsString();
return output({ success: true, content });
}
function downloadFile(data) {
try {
const file = DriveApp.getFileById(data.fileId);
const blob = file.getBlob();
const base64 = Utilities.base64Encode(blob.getBytes());
return output({
success: true,
fileName: file.getName(),
mimeType: blob.getContentType(),
base64: base64
});
} catch (e) {
return output({ success: false, error: e.toString() });
}
}
function getDirectLink(data) {
try {
const id = data.fileId;
const url = "https://drive.google.com/uc?export=download&id=" + id;
return output({ success: true, url });
} catch (e) {
return output({ success: false, error: e.toString() });
}
}
function getFiles(data) {
try {
const folder = DriveApp.getFolderById(data.folderId);
const files = folder.getFiles();
const names = [], sizes = [], urls = [], dates = [], ids = [];
while (files.hasNext()) {
const file = files.next();
names.push(file.getName());
sizes.push(file.getSize());
ids.push(file.getId());
urls.push("https://drive.google.com/uc?export=download&id=" + file.getId());
dates.push(file.getLastUpdated().toISOString());
}
return output({
success: true,
fileNames: names,
fileSizes: sizes,
fileUrls: urls,
lastUpdateDates: dates,
fileIds: ids
});
} catch (e) {
return output({ success: false, error: e.toString() });
}
}
Leave your Suggestions and If like , give for me
Updating the extension
for Good thing