<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>ledgermode &amp;mdash; sandeepk</title>
    <link>https://blogs.dgplug.org/sandeepk/tag:ledgermode</link>
    <description></description>
    <pubDate>Fri, 24 Apr 2026 21:38:11 +0000</pubDate>
    <item>
      <title>Emacs: Building Ledger Reports</title>
      <link>https://blogs.dgplug.org/sandeepk/emacs-building-ledger-reports</link>
      <description>&lt;![CDATA[I have started my financial journaling a few months back, and I am happy with the simplicity and freedom that I can have with the use of  Emacs, ledger-mode, and Ledger. I have written about it before, you can check that here. Today we will talk about report generation.&#xA;&#xA;So, for this post, we will be using this mock data for generating balance and monthly expense reports. Create a new file with the name  ledger.dat and paste the data in it given below.&#xA;&#xA;2021/02/14  Dinner-Party&#xA;    Expenses:Food:Party                            1500&#xA;    Assets:Bank:Checking&#xA;&#xA;2021/02/21  Lunch-Party&#xA;    Expenses:Food:Party                           1600&#xA;    Assets:Bank:Checking&#xA;&#xA;2021/02/22  Home&#xA;    Expenses:Home                                   3000&#xA;    Assets:Bank:Checking                       3000&#xA;    Assets:Investment:Stocks                 180000&#xA;    Assets:Bank:Checking&#xA;&#xA;2021/02/25  Amazon Shopping&#xA;    Expenses:Self                                60000&#xA;    Assets:Bank:Checking&#xA;&#xA;So let&#39;s start with the balance report, open the Emacs with the ledger.dat file, then press C-c C-o C-r. The buffer will ask the report name type in bal and hit enter, you will get the report.&#xA;&#xA;Report: bal&#xA;Command: ledger -f /home/ledger.dat bal&#xA;&#xA;              -66100  Assets&#xA;             -246100    Bank:Checking&#xA;              180000    Investment:Stocks&#xA;&#x9;       66100  Expenses&#xA;&#x9;&#x9;3100    Food:Party&#xA;&#x9;&#x9;3000    Home&#xA;&#x9;       60000    Self&#xA;--------------------&#xA;                   0&#xA;&#xA;There is another way which I use mainly is from the terminal itself.&#xA;&#xA;      ledger balance -f ledger.dat&#xA;              -66100  Assets&#xA;             -246100    Bank:Checking&#xA;              180000    Investment:Stocks&#xA;               66100  Expenses&#xA;                3100    Food:Party&#xA;                3000    Home&#xA;               60000    Self&#xA;--------------------&#xA;                   0&#xA;&#xA;If you only want to see a particular type of expense, you can easily do so by&#xA;here we are only seeing the expenses&#xA;      ledger balance -f ledger.dat Expenses&#xA;               66100  Expenses&#xA;                3100    Food:Party&#xA;                3000    Home&#xA;               60000    Self&#xA;--------------------&#xA;               66100&#xA;&#xA;here we are seeing the Checking account&#xA;      ledger balance -f dummy.dat Checking&#xA;             -246100  Assets:Bank:Checking&#xA;&#xA;We can also see month-wise expense, for that, I have changed the date in the file ledger.dat.&#xA;      ledger -M --period-sort &#34;(amount)&#34; reg ^expenses -f ledger.dat&#xA;21-Jan-01 - 21-Jan-31                             Expenses:Food:Party                                              1600                    1600&#xA;21-Feb-01 - 21-Feb-28                             Expenses:Food:Party                                              1500                    3100&#xA;                                                  Expenses:Self                                                   60000                   63100&#xA;21-Mar-01 - 21-Mar-31                             Expenses:Home                                                    3000                   66100&#xA;&#xA;Reports help to see your money flow, calculate the expenses and savings.&#xA;&#xA;Cheers!&#xA;&#xA;#100DaysToOffLoad #Emacs #LedgerMode #Ledger &#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>I have started my financial journaling a few months back, and I am happy with the simplicity and freedom that I can have with the use of  Emacs, ledger-mode, and Ledger. I have written about it before, you can check that <a href="https://blogs.dgplug.org/sandeepk/emacs-and-financial-journaling" rel="nofollow">here</a>. Today we will talk about report generation.</p>

<p>So, for this post, we will be using this mock data for generating balance and monthly expense reports. Create a new file with the name  <em>ledger.dat</em> and paste the data in it given below.</p>

<pre><code class="language-dat">2021/02/14 * Dinner-Party
    Expenses:Food:Party                            1500
    Assets:Bank:Checking

2021/02/21 * Lunch-Party
    Expenses:Food:Party                           1600
    Assets:Bank:Checking

2021/02/22 * Home
    Expenses:Home                                   3000
    Assets:Bank:Checking                       3000
    Assets:Investment:Stocks                 180000
    Assets:Bank:Checking

2021/02/25 * Amazon Shopping
    Expenses:Self                                60000
    Assets:Bank:Checking

</code></pre>

<p>So let&#39;s start with the balance report, open the Emacs with the ledger.dat file, then press <em>C-c C-o C-r</em>. The buffer will ask the report name type in <em>bal</em> and hit enter, you will get the report.</p>

<pre><code class="language-bash">Report: bal
Command: ledger -f /home/ledger.dat bal

              -66100  Assets
             -246100    Bank:Checking
              180000    Investment:Stocks
	       66100  Expenses
		3100    Food:Party
		3000    Home
	       60000    Self
--------------------
                   0

</code></pre>

<p>There is another way which I use mainly is from the terminal itself.</p>

<pre><code class="language-bash">&gt;&gt;&gt;  ledger balance -f ledger.dat
              -66100  Assets
             -246100    Bank:Checking
              180000    Investment:Stocks
               66100  Expenses
                3100    Food:Party
                3000    Home
               60000    Self
--------------------
                   0

</code></pre>

<p>If you only want to see a particular type of expense, you can easily do so by</p>

<pre><code class="language-bash"># here we are only seeing the expenses
&gt;&gt;&gt; ledger balance -f ledger.dat Expenses
               66100  Expenses
                3100    Food:Party
                3000    Home
               60000    Self
--------------------
               66100

# here we are seeing the Checking account
&gt;&gt;&gt;ledger balance -f dummy.dat Checking
             -246100  Assets:Bank:Checking

</code></pre>

<p>We can also see month-wise expense, for that, I have changed the date in the file ledger.dat.</p>

<pre><code class="language-bash">&gt;&gt;&gt; ledger -M --period-sort &#34;(amount)&#34; reg ^expenses -f ledger.dat
21-Jan-01 - 21-Jan-31                             Expenses:Food:Party                                              1600                    1600
21-Feb-01 - 21-Feb-28                             Expenses:Food:Party                                              1500                    3100
                                                  Expenses:Self                                                   60000                   63100
21-Mar-01 - 21-Mar-31                             Expenses:Home                                                    3000                   66100

</code></pre>

<p>Reports help to see your money flow, calculate the expenses and savings.</p>

<p>Cheers!</p>

<p><a href="/sandeepk/tag:100DaysToOffLoad" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">100DaysToOffLoad</span></a> <a href="/sandeepk/tag:Emacs" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Emacs</span></a> <a href="/sandeepk/tag:LedgerMode" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">LedgerMode</span></a> <a href="/sandeepk/tag:Ledger" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Ledger</span></a></p>
]]></content:encoded>
      <guid>https://blogs.dgplug.org/sandeepk/emacs-building-ledger-reports</guid>
      <pubDate>Sun, 11 Apr 2021 10:32:50 +0000</pubDate>
    </item>
  </channel>
</rss>