I want to invert the spreadsheet so I get the data at the top every day.

I've tried to


but that doesn't seem to work. Would anyone know how to invert the .csv file?


This is the easiest way to achieve the descending sort:

  • Thank you, but may you explain how you came with the 3 in order to sort? What did the 3 do? – Tyler Durden Apr 13 '16 at 15:45
  • 3 is the column index to sort by. In this case your 3rd column is the date column – Aurielle Perlmann Apr 13 '16 at 15:47

Applying sort is certainly the easiest, it sometimes results in the header row getting sorted to the bottom or middle of the table. In such situations query can help, as it allows one to specify the number of header rows. The query string select * order by Col3 desc sorts by 3rd column, descending.

=query(importdata("http://www.tr4der.com/download/historical-prices/SPY/"), "select * order by Col3 desc", 1)

The number 1 here indicates that the data has 1 header row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.