Nov 25, 2021 03:45 AM
Hey all,
I’ve been working on a Powershell script that creates many text files of various directories scattered on a network. Each text file contains lists of the file content of a network directory, name and extension.
I figured I may as well use Airtable to audit each text file - which it does well. But the catch is, I’m not sure how I can actually parse a text file that I’ve uploaded into the Airtable attachments field into a Long Text field. Can this be done via an Automation?
It was great when I discovered that I could bulk upload Text.txt files into separate records via the Gallery View Yellow button, simply select a bunch of files and drag it to the button - Excellent - that solved my first hurdle!!! But… now… I’m slightly concerned that as easy as those text files were to upload, I’ve no actual method to copy their content into a Long Text field and then do my usual Airtable formula thing to pull the text data apart.
Appreciate any guidance on this! Perhaps I’ve gone about this process upside down? Keen to hear your thoughts.
PS: I briefly looked into this completely different method here;
Where by using the Scripting App to upload a text file and copy its content into long text fields (doesn’t matter that the actual file isn’t attached as an attachment, I just need the text data into a long text field), but I wasn’t sure of how I could bump the script from importing one file at a time, to many files in one process.
Solved! Go to Solution.
Nov 25, 2021 05:43 AM
Scripting app cannot process multiple local files at once. Scripting requires user interaction for each local file. Fortunately, you do not need to do so.
You can upload your text files in bulk using a gallery view. Then once the files are fully attached, scripting can fetch
the contents of the text files from the attachment url and put the text in a long text field.
Nov 25, 2021 05:43 AM
Scripting app cannot process multiple local files at once. Scripting requires user interaction for each local file. Fortunately, you do not need to do so.
You can upload your text files in bulk using a gallery view. Then once the files are fully attached, scripting can fetch
the contents of the text files from the attachment url and put the text in a long text field.
Nov 25, 2021 02:58 PM
@kuovonne - do you have a coffee fund that I may donate to? :coffee:
With your fetching advice I was able to get a script working exactly as I’d dreamed, it’s amazing!
For anyone else working on similar text extraction processes, I found the best trigger to be when a record entered a view. If other trigger methods are used, even though the attachment has uploaded with an available URL it’s simply not ready for processing and you’ll extract denial request. But using the Record Enters a View method, this gives enough breathing space and the log seems to process as desired.
Nov 25, 2021 06:06 PM
I’m glad that you were able to figure out the details.
Since you have to manually upload the text files to the gallery view, you might want to run the script from a Scripting app, instead of an automation. This will save you an automation slot and automation runs. You can also visually inspect the attachment icons to check when all of the attachments are uploaded before clicking the button.
It’s not exactly a coffee fund, but some of my scripts are “pay what you want”, such as these helpers for email automations. You can “buy” this script with whatever coffee tip you like.