I was using this code: https://gist.github.com/pamelafox/1878143
Everything works for rows:
// getRowsData iterates row by row in the input range and r