Extract File Size from From Attachments

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.

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.

Hey @ScottWorld Can yo help me with more information on Automation that will revel the size of Attachments.

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:

Our On2Air Actions app has a function that will calculate the sum of all file sizes in a field.

1 Like

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)));}

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.

I’m also looking for a solution to calculate a single file, this is really odd it doesn’t exist.

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.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.