2

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

I've tried to

=sort(importdata("=importdata("http://www.tr4der.com/download/historical-prices/SPY/"),1,false)

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

2 Answers 2

5

This is the easiest way to achieve the descending sort:

=sort(importdata("http://www.tr4der.com/download/historical-prices/SPY/"),3,false)
2
  • Thank you, but may you explain how you came with the 3 in order to sort? What did the 3 do? Apr 13, 2016 at 15:45
  • 3 is the column index to sort by. In this case your 3rd column is the date column Apr 13, 2016 at 15:47
2

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 and acknowledge you have read our privacy policy.

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