Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Adding header to csv file with Applescript overwrites beginning of file. Why?


This topic is 4575 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm trying to add a header to my bank statement to import it into Filemaker properly, but my script overwrites the first four characters before adding the desired text. I'm quite green with Applescript, and I can't see my mistake. Any help would be appreciated.

Here's the beginning of the file before the script (date, amount, transaction type, transaction detail) is run

4/30/12,-63.00,000000399,"Cheque",""

and after:

,,,

/12,-63.00,000000399,"Cheque",""

I wanted to add the ",,,

"

What's happened to "4/30" ?

Here's my script:

tell application "Finder"

open for access "Macintosh HD:Users:johnnolan:Documents:RandB database FM12:Statements:Exported from containers:temp_statement.csv" with write permission

write ",,," & return to file "Macintosh HD:Users:johnnolan:Documents:RandB database FM12:Statements:Exported from containers:temp_statement.csv"

close access file "Macintosh HD:Users:johnnolan:Documents:RandB database FM12:Statements:Exported from containers:temp_statement.csv"

end tell

Posted

Not directly related to your question, but why is it necessary "to add a header to my bank statement to import it into Filemaker properly"? If you know in advance the order of the columns, why not simply import the file using a script?

Posted

I am importing with a script, but I can't get the first record in; the file just starts with data on the first line; I get the second and subsequent records imported, but not the first. Is there some other way around this?

Posted

You don't need to use Applescript at all in filemaker you create a youur script step there is a dialog or checkbox on the import script step that asks if you wish to import the first row as column headers or treat it as DATA you will wish to select the second option and you will result in importing all your data.

Posted

Duh! I had inadvertently set the file type to merge in my first attempt with the script, and after that missed the option... there's a few hours I'll never get back.

Thanks!

This topic is 4575 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.