Back to the schedule
Previous: Reproducible molecular graphics with Org-mode
Next: Budgeting, Project Monitoring and Invoicing with Org Mode

Find Your (In)voice: Emacs for Invoicing

Bala Ramadurai


Q&A: answering after the conference
Duration: 9:59

This talk was also streamed at an alternate time for APAC hours:

If you have questions and the speaker has not indicated public contact information on this page, please feel free to e-mail us at and we'll forward your question to the speaker.


Name pronunciation: BA-lA
Pronouns: he/his
Preferred contact info

Ye Freelance warriors, please lend me your I/O devices for 5 minutes.

Your time is your money! Do you find it a pain to generate an invoice, record the details into your accounting software and keep track of taxes and payments? You are not alone, I found the whole invoice thingy to be extremely painful.

But worry not, Emacs comes to our rescue.

My talk will give you a basic intro on how to use org mode, some embedded python code and file jugglery to generate stylistic and professional invoices.

What you will learn during the session:

  • How to track your freelance time using orgmode
  • How to create the basic infrastructure for invoice generation
  • How to generate the invoice
  • How to manage multiple clients
  • How to enter the finance details into your accounting software
  • How to track invoice payments

We will use the following packages:

  • Emacs+orgmode (duh?)
  • yasnippet
  • python layer (I use spacemacs, so whatever is the equivalent in your config)
  • Some unnecessary Shakespearean references


  • okay, this is some next level invoicing automation!
  • The accounting system transactions are a nice touch
  • it's really hard to tell that came from org :)
  • European format would be DD.MM.YYYY and not with dashes which can be mixed up with ISO or other formats. in the UK it's often with slashes: DD/MM/YYYY
  • From YouTube: This looks great! Much better than my amateurish attempts. Thanks!!!


What is an invoice? Invoice is a document that you give it to your customer so that they can pay you for your service or your goods. But you are a professor and consultant. Why do you need to generate invoices? Well... I do a service for my clients if I'm a consultant, and when I'm a professor, I'm teaching students, so I have to generate an invoice. Why not use Excel or something simple to generate your invoices? I've tried that. It's no good, when it... particularly, when there are many clients, managing Excels and templates becomes very very tricky. Why don't you hire someone, you know, professional to do these for you? I've tried it. I have to give them lots of information. Not that there's anything wrong with them, just that I found it to be a bit too tricky. Professional software? Good point. I've tried that too. But, what's the fun in that, right? So what did you do? Haa.. this is the interesting part! I took a software called Emacs Org mode and with that, I added Python code to it. I added so many other things to it, and then it became a really nice customizable way to generate invoices. Whoa whoa whoa... Just slow it down, bro. Give me the story. Hey. Okay... Okay... I will. Story. Uh.. Story is simple. The client wanted an invoice. So, I generated an invoice. It wasn't good enough. So, I hacked some little bit of it. I changed every time a new client came. I had to do it all over again. I did that. I did it. Then I got really tired of it. And that's what led me to all these customizations. I want features. So, rapid fire questions. Ready? Yep. Project management? Yep. Format customization? Yes. PDF export? Yes. Multi-client support? Yes. Washing my clothes? Yes... No. Haa. I was just testing you, if you're paying attention or not. Logo and signature customization? Yes. Multi-currency support? Yes. Okay, enough talky or it's just... Can you show me a demo that you did? Or is it just talky. Yes, of course. Demo. Okay, demo time. Some ingredients for invoicing. Org mode, of course. Python environment and libraries for Python: pandas, tabulate, numbers. yasnippet package, very useful. And I use for LaTeX, MikTeX packages. So, I have a project already set up. This is what we have. The project is Teaching 2021 and you can set all this up. So let's start with the first and foremost. Okay, so we're going to use the yasnippet package. uh.. um.. sorry, the invoice, okay. This one introduced, it gives you this whole... generates this whole bunch of code based on a template. All you're going to do is to type out the client's name. Okay and that's it. That's all there is to it. Okay there's a whole bunch of instructions that you can follow. If it's for the first time, use Let's check out what involves. Okay so you can copy this template from my GitHub repository. It's basically setup of the LaTeX tags, and particularly this text file, which is a template. There's some personal info for all the details that you want. Bank information. You can look at it in detail from my repo. The tax invoice... There are some basic constructs. You can totally change any of these to your liking. Okay, so that's bank info. Go back. That's the first part. The second part is creating a client name. So let's look at this setup, and I have one created already. So, in order to create this, all you need to do is to use the inv-setup invoice setup for your client, and it will give you all the information. All you need to do is type in here and then type in the client's name, exactly the same that you see as the file name. Okay, client one. And that's it. You're all set for you. Okay, so that's what it looks like. All the address and stuff filled out here. Okay. And then the next one is to use the... One time, you're going to do the invoice item, which is the rate table. So let's do the invoice. Invoice item... This is item master. So here again, another place where you have to enter the client name, and your rate table is ready for use. Okay. So that was... Now we go to step two, which is clock table for reference. Okay. Let's go to the clock table. I already set up this for ACMEClient1, and I give it a tag: billable. Okay. We will see that... Where have I done that? Okay, so that's the client, you know, ACMEClient1 table teaching 2021. I've clocked it for the previous month. That's what you will see. Let's see it again. Okay. That's... Let's put the instructions. And then you go to clock table to generate the clock table for the client. Okay. So clock table... This is only for your reference, not going to be exported. Here we get a clock table. All right. So with this, you get the clock table. Okay. Now go into the items part. You will see two Python blocks, which is what the next instruction says. Go into the python block and do Control-c c (C-c c). Go to the control python source block, second one, and do Ctrl-c c... Ctrl-c Ctrl-c (C-c C-c) rather. and then finally come back to Raise Invoice and do dispatcher which is exported into PDF. Okay, let's do that. First one is... I just run this code, and it generated this table for me. Okay. So it has all the details. Now we go in the second source code block, and does all this... And it has generated this stuff. Plus, you should note that for beancount, it has also generated the block for that. It's all in the code. You can customize it if you're on Ledger. You can customize it to the way you want, any accounts that you want to change. It's all customizable. Here, even the currency symbols can be changed from INR and Rupees to whatever currency you have can be changed accordingly. I have org-babel-tangle-append code that I will share in the... I've borrowed it from somebody on the Internet, so I'll share that as well in my GitHub repo. Lastly, I just want to share that you can fill your GST website with these info, so you can... You can even put in as many entries as you want in your yasnippet. Customize it the way you want. I also added a month later due date reminder, saying if the invoice is paid or not. Okay. So, a few tips to end this demo. You can customize currency symbol and currency words according to your own currency. I use the European/Indian date format which is %d-%m-%Y. You can also... The language is Indian English, so it will change according-- the numerals change according to the Indian format. Numbering format for invoice number is today's date followed by client name. That's my default. You can customize that as well. Let's try and export this to the subtree. Ctrl-s. So that's step number seven. And there it is, the tax invoice for Dr. Wile E. Coyote, and with a lovely signature as well. Interviewer: Well, that's great! If I were to try this out, what do I do? Go to, into my repository. I'll leave my GitHub URL. You can download it use it, and let me know how it pans out for you. Interviewer: I have spent

Back to the schedule
Previous: Reproducible molecular graphics with Org-mode
Next: Budgeting, Project Monitoring and Invoicing with Org Mode