I bought a dishwasher.How do I convert the hardness level of the water from mg/liter(ppm) to grains per gallon(gpg)?

Use the formula below:

Mg/liter (or ppm) 17.1 = grains per gallon (gpg)