Upload batches of expenses from a spreadsheet
I know that this has been mooted before (http://getsatisfaction.com/freeagentc...) but I wonder if we could revisit the idea of upload of expenses in a similar fashion to the CSV upload of bank statements?
I'm trying to transfer my accounts to FAC and I have several hundred expense items from the past this year which will need to be re-entered if my online accounts are to mirror our current spreadsheet-based system. I can't re-enter the invoices unless I've already input all the expenses. All the data is there and re-typing it seems ... daunting.
Any chance?
I'm trying to transfer my accounts to FAC and I have several hundred expense items from the past this year which will need to be re-entered if my online accounts are to mirror our current spreadsheet-based system. I can't re-enter the invoices unless I've already input all the expenses. All the data is there and re-typing it seems ... daunting.
Any chance?
1
person likes this idea
I like this idea!
Tell me when this idea gets some attention.
The more people who like this idea, the more it gets noticed.
The more people who like this idea, the more it gets noticed.
The company has not planned to implement this.
-
Inappropriate?Hi DJ
We don't plan on adding support for this in the near future.
However, if you're technical, we do have an API which would make it easy to write a script to parse your expense spreadsheet and upload the expenses into FreeAgent.
Would this be an option for you? -
Inappropriate?Using the API is a great idea - and I'm some of the way there. However, I am a bit stuck with 500 server errors - so a bit of assistance would be appreciated. When I've worked out how to do this, I'm happy to upload a full description for those that would like to do the same.
Warning: my brain is hurting. If you're not technically minded, stop reading now.
I'm using CURL. This runs in Terminal in OSX on a Mac but it also works on the Command Line within Windows. See http://curl.haxx.se/
I started by interrogating my company data using the following syntax (I've replaced "email" and "password" and "mycompany" with my relevant values)
curl -i -u 'emai:password' -H 'Accept: application/xml' -H 'Content-Type: application/xml' 'https://mycompany.freeagentcentral.com/invoices'
This lists all invoices in XML.To do other things, you just need to replace the url at the end. Using:
'https://mycompany.freeagentcentral.com/users'
gives me a list of users. Within the XML there is an ID field for each user. Using this ID number (mine is 4647) I can the replace the URL with this:
'https://mycompany.freeagentcentral.com/users/4647/expenses?view=all'
This downloads all my expenses. (The "?view=alll" bit at the end took me a while to figure out.) If I just want a single expense, I can look once again at the XML and find the ID for the expense. For instance, finding on that has the ID 12345 then I can use:
'https://mycompany.freeagentcentral.com/users/4647/expenses/12345'
to view the details. So far, so good. Now for the tricky bit - POSTing new expense entries.
I've tried three things here, just to upload one test expense. None of the things which I've tried is working - all of them are giving me a 500 error.
1) I used several -d options within the curl command line (I've spread this over several lines to make it easier to read):
-d expense-description='Travel'
-d dated-on='2008-01-09'
-d description='test expense'
-d gross-value=15
'https://mycompany.freeagentcentral.com/users/4647/expenses'
2) I put the expenses into a file called new_expenses.txt which contains the text:
dated-on=2008-01-09&description=test%20expense&expense-type=Travel&gross-value=15
and use
-d @new_expenses.txt
3) I put the expenses into and XML file which contained the text:
<expense>
<dated-on>2008-01-09T00:00:00Z</dated-on>
<description>Test expense</description>
<expense-type>Travel</expense-type>
<gross-value>-15</gross-value>
</expense>
and used the -T option in curl to upload this to the server.
I'm clearly missing something here. Any suggestions/hints gratefully received.
Cheers
DJ
I’m a geek, it turns out
-
Inappropriate?RIGHT. Sorry about this - I'm sure these posts should go on the API user group on google - but while I'm here, I should just say that I worked it out:
Method 3 (above) - the XML file - and the following command:
curl -u 'email:password' -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d @new_expenses.txt -X POST 'https://mycompany.freeagentcentral.com/users/4647/expenses' -i -v
I can write this up for mac users. I may need some help converting this for windows users.
DJ
-
Inappropriate?For what it's worth, I've now done this - and have several hundred expenses uploaded. I need a holiday - but it is possible. At least on a Mac. Anyone who would like some encouragement is welcome to ask
I’m quite tired
Loading Profile...



