getData function

A function to extract data