Importing CSV data

I used a different mechanism to keep record of web pages I found interesting. I now have it archived in a spreadsheet and want to put it into Eagle Filer.

The data has a couple of tag columns, a URL, the page title and a note explaining why I wanted to remember the thing. I want to import the items with tags and the note. I am brand new to EF, still in trial mode, so might be missing something but cannot find it if I am.

If I can do this, I am buying asap. So far I like EF a lot.

Thanks for your advice.

There’s no built-in support for that, but it should be straightforward to do with a script. I can help you with that if you post a sample of your CSV file so that I can see the format.

Sorry to necro, but is your offer still open Michael? I love Eagle and am migrating all my data from on over, I exported it as a CSV file.

Format’s as follows:

686510518,r/godot - I'm very proud of myself for figuring out Godot's drag-and-drop system for control modes,Godot drag and drop example,367 votes and 31 comments so far on Reddit,,Unsorted,"drag and drop, drag n drop",2023-11-29T21:27:19.767Z,,
684191870,"GitHub - aikoncwd/Godot-FOV-algorithms-roguelike: Some FOV algorithms for roguelikes, in Godot 3.x",Raycasting field of vision FOV MRPAS MINGO occlusion for tilemaps,"Some FOV algorithms for roguelikes, in Godot 3.x. Contribute to aikoncwd/Godot-FOV-algorithms-roguelike development by creating an account on GitHub.",,Unsorted,"FOV, dungeon, roguelike",2023-11-25T15:49:00.304Z,,
664368830,Game Dev Tools & Resources,Game Resources,Graphics & Design Tools  Game UI database - A resource for UI design patterns in games. Coolors - Quick color scheme generator. Corel Vector - A vector graphic design tool. Figma - Collaborative design tool. GIMP - A free alternative to Photoshop. Krita - Digital painting tool. Paint.Net - Anothe...,,Unsorted,,2023-10-20T14:44:20.346Z,,

Here’s a script that should work with that format:

use AppleScript version "2.4"
use framework "Foundation"
use scripting additions

set _file to choose file with prompt "Select a CSV file." of type {"csv"}
set _path to POSIX path of _file
set _script to "sqlite3 :memory: '.import --csv  " & _path's quoted form & " tab' '.mode json' 'select * from tab'"
set _jsonString to do shell script _script
set _jsonNSString to my (NSString's stringWithString:_jsonString)
set _jsonData to _jsonNSString's dataUsingEncoding:(my NSUTF8StringEncoding) allowLossyConversion:true
set _array to my (NSJSONSerialization's JSONObjectWithData:_jsonData options:0 |error|:(missing value))

set _dateFormatter to my NSISO8601DateFormatter's alloc's init
set _internet to my NSISO8601DateFormatWithInternetDateTime
set _fractional to my NSISO8601DateFormatWithFractionalSeconds
_dateFormatter's setFormatOptions:(_internet + _fractional)

repeat with _dict in _array
    set _title to (_dict's objectForKey:"title") as Unicode text
    set _note to (_dict's objectForKey:"note") as Unicode text
    set _url to (_dict's objectForKey:"url") as Unicode text
    set _tagsString to (_dict's objectForKey:"tags") as Unicode text
    set _createdString to (_dict's objectForKey:"created")
    set _date to (_dateFormatter's dateFromString:_createdString) as date
    set AppleScript's text item delimiters to ", "
    set _tagNames to text items of (_tagsString as Unicode text)
    tell application "EagleFiler"
        tell library document 1
            set {_record} to import URLs {_url} note _note tag names _tagNames
            set _record's title to _title
            set _record's creation date to _date
        end tell
    end tell
end repeat

Ah, I never used Applescript before, so forgive me. I pasted it on into the Script Editor and tried running it, but it failed on line containing “Tell library document 1” with a “Expected end of line but found class name.” error.

All the code above though became syntax highlighted, and I pasted each line in separately to see if it was correct or not. :

I included a screenshot of the error.

One of the lines in your screenshot says:

tell application "Eagle"

but should say:

tell application "EagleFiler"

Weird, Script Editor is removing that “Filer” portion of the name and truncating it to “Eagle”. There was only one time I could tell it where EagleApp lived…it hasn’t asked me since. Is there a way to make it so I can point it to the app again?

Appreciate the help!



It should never have asked you to point it to the app. That would seem to indicate that the app was not properly installed. Do you have it in a non-standard location (i.e. not the Applications folder)?

If you launch the app before compiling the script, Script Editor should find it from the running processes rather than looking on disk.

I don’t remember installing it any differently than any of my other apps. When it’s running, I run the script and it still produces the same error, no changes and it still doesn’t syntax highlight that code after the line:

tell application “EagleFiler”


Hmm, I’ve been using AppleScript since the beginning and have never seen that happen. Which version of macOS are you using?

Does it work if you change that line to:

tell application id "com.c-command.EagleFiler"