How to use date related function when data column is integer
<p>This is a function to pull dividend information from Yahoo Finance.</p>

<pre><code>=importdata("http://real-chart.finance.yahoo.com/table.csv?s=T&amp;a=1&amp;b=1&amp;c=2010&amp;d="&amp;
month(today())&amp;"&amp;e="&amp;DAY(today())&amp;"&amp;f="&amp;year(today())&amp;"&amp;g=v&amp;ignore=.csv")
</code></pre>

<p>This returns...</p>

<pre><code>  A       B
Date    Dividends
42648   0.48
42557   0.48
42466   0.48
42375   0.48
42284   0.47
42193   0.47
42102   0.47
42011   0.47
41920   0.46
41828   0.46
41737   0.46
41647   0.46
41555   0.45
41463   0.45
41372   0.45
41282   0.45
41187   0.44
41096   0.44
41004   0.44
40914   0.44
40821   0.43
40730   0.43
40639   0.43
40549   0.43
40457   0.42
40366   0.42
40275   0.42
</code></pre>

<p>What I'm trying to do is to group by year of each transaction. I found a workaround to achieve this.</p>

<pre><code>=QUERY( A:B, 
"Select year(A) , sum(B) Where A is not null Group by year(A) Label year(A) 'Year',  
sum(B) 'Total'" , 1)
</code></pre>

<p>*Result</p>

<pre><code>Year    Total
2010    70.530003
2011    85.077798
2012    85.877801
2013    99.133401
2014    90.649999
2015    87.259999
2016    104.349998
</code></pre>

<p>Although this works great if I manually change the cell format of Column A into date format, I'd like to make it into one function. More of something like this.</p>

<pre><code>=query(importdata("http://real-chart.finance.yahoo.com/table.csv?s=T&amp;a=00&amp;b=3&amp;c=2000&amp;d="&amp;
month(today())&amp;"&amp;e="&amp;DAY(today())&amp;"&amp;f="&amp;year(today())&amp;"&amp;g=v&amp;ignore=.csv"),
"Select year(Col1) , sum(Col2) Where Col1 is not null Group by year(Col1) 
Label year(Col1) 'Year',  sum(Col2) 'Total'")
</code></pre>

<p>This function gives me an error message saying </p>

<blockquote>
  <p>Can't perform the function year on a column that is not a Date or a
  DateTime column</p>
</blockquote>

<p>I guess it is because Col1 is integer, not a date format.</p>

<p>Any workaround to make this work?</p>