Check Google Drive Storage Limit and Used Storage Info
Posted By: Harish

Google gives a free storage limit of 15GB per account (at the time of writing this post). If you buy their storage, your drive storage limit will be extended.
To check the total storage of your drive or used storage, visit Google Drive Quota page.
This data includes used storage from different google products. Please note that shown storage used data is excluding trash bin storage.
Get storage limit and used storage using apps script
Open Google Apps Script editor and create a new project.
Replace the default function (which already exists) with the below function and run it. Visit creating and executing a Google Apps Script post for more info.
function getGoogleDriveStorageLimitAndUsedStorage() {
try {
const storageLimitinBytes = DriveApp.getStorageLimit();
const storageLimitinKB = storageLimitinBytes / 1024;
const storageLimitinMB = storageLimitinKB / 1024;
const storageLimitinGB = storageLimitinMB / 1024;
console.log(`Storage Limit: \n ${storageLimitinKB} KB or \n ${storageLimitinMB} MB or \n ${storageLimitinGB} GB`);
const usedStorageInBytes = DriveApp.getStorageUsed();
const usedStorageInKB = (usedStorageInBytes / 1024).toFixed(4);
const usedStorageInMB = (usedStorageInKB / 1024).toFixed(4);
const usedStorageInGB = (usedStorageInMB / 1024).toFixed(4);
console.log(`Storage Used: \n ${usedStorageInKB} KB or \n ${usedStorageInMB} MB or \n ${usedStorageInGB} GB`);
} catch (err) {
Logger.log(err)
}
}
By executing the above function, storage limit and used storage will be logged to the execution log window.
We get total drive storage or used storage in bytes. So, we are converting to required byte units.