Jun 09, 2022 03:23 AM
I am facing issue in Files Table. I have column name “File” ,I did the setup to get the size using formula, in column “File size” but that is not working now. Can you please help me with this issue?
Actually, It was working till yesterday , but today it stopped working and I cannot find the formula. Can you please help me out with the task, I jsut want formula to get File Size from From Attachments.
Jun 09, 2022 03:33 AM
There isn’t a formula to get the file size from attachments, but you can get it through Airtable’s automations, which will reveal the size of attachments.
Alternatively, you can get the file size through any tool that has access to the Airtable API, such as scripting, datafetcher.com, Make.com, or MiniExtensions’ attachment size extension.
Jun 09, 2022 05:15 AM
Hey @ScottWorld Can yo help me with more information on Automation that will revel the size of Attachments.
Jun 09, 2022 08:51 AM
You could trigger your automation with a checkbox field or a single-select field, and then update the record with the size of the attachment in a separate size field.
If you haven’t worked with automations yet, here is Airtable’s guide on it:
Jun 09, 2022 08:57 AM
Our On2Air Actions app has a function that will calculate the sum of all file sizes in a field.
Jun 09, 2022 09:37 AM
Hi,
may be useful for you, some time ago i did a script to count size of all attachments in all base per table
const inMb=(bytes)=>(bytes?`${Math.round(bytes/Math.pow(1024,2))} Mb`:'');const ts=[];
for(var table of base.tables) ts.push(await count(table))
if (sum(ts)) {output.table(ts.filter(n=>n).map(x=>(x?{size:inMb(x.size),name:x.tname}:{})));
output.markdown(`**Total: **${inMb(sum(ts)?.size)}`)}
function sum(arr){return (!arr||!arr.length||!(arr.some(n=>n)))? null:
{size:arr.filter(n=>n).map(x=>x.size).reduce((x,y)=>x+y),tname:table.name}};
async function count(table){
let flds=table.fields.filter(fld=>fld.type.includes('Attach'));
let query=await table.selectRecordsAsync({fields:flds});
return sum(flds.flatMap(fl=>query.records.map(x=>x.getCellValue(fl)).map(sum)));}
Jun 10, 2022 02:53 AM
Hey, hanks for he reply, I just want to calculate the Size of one file at a time and Use to Script to calculate every new file added in my Airtable Row and File size into its Corresponding table.
Can you help me with that.
Jun 19, 2022 06:14 AM
I’m also looking for a solution to calculate a single file, this is really odd it doesn’t exist.
Jun 19, 2022 07:04 AM
The only way that you can calculate the size of a single file within an attachment file that contains multiple files in it would be to loop through the array of all the attachments in that field.
Looping is not supported by Airtable’s Automations, so you would need to write a custom script for this (which requires coding knowledge), or if you don’t want to learn code, you would need to use a no-code/low-code automation tool such as Make.com, which allows you to loop through arrays.
In Make.com, you loop through arrays using their Iterator tool.
I have not investigated how to do this in other automation tools, but I am assuming that it is possible with other tools as well.