In August 2017, advanced Virgo joined advanced LIGO for the end of the O2 run, leading to the first gravitational waves detections with the three-detector network. This paper describes the advanced Virgo calibration and the gravitational wave strain h(t) reconstruction during O2. The methods are the same as the ones developed for the initial Virgo detector and have already been described in previous publications; this paper summarizes the differences and emphasis is put on estimating systematic uncertainties. Three versions of the h(t) signal have been computed for the Virgo O2 run, an online version and two post-run reprocessed versions with improved detector calibration and reconstruction algorithm. A photon calibrator has been used to establish the sign of h(t) and to make an independent partial cross-check of the systematic uncertainties. The uncertainties reached for the latest h(t) version are 5.1% in amplitude, 40 mrad in phase and 20 μs in timing