If you wanted to do it from the database, then you would add a recordset to the cart page and have it filter based on the value of $eCart1->TotalColumn("Quantity"). Once the recordset returns the correct charge, then you can store that as a session variable and use the Shipping tab in the eCart object to add a shipping charge equal to the value stored as that session variable.
Perhaps an easier way to do it is to not use the database and add the rows as individual shipping rules. You would add one shipping rule per price and set them "based on the number of items in the cart" with the flat rate charge based on your spreadsheet.