I'm afraid that it will not work by just changing the Get-Datacenter to Get-Cluster.
The reason is the Get-Datastore cmdlet later on in the script, on the Location parameter it only accepts Datacenter, Folder, and DatastoreCluster objects.
But with a small small change we can get it to work for clusters as well.
Get-Cluster | Select Name,
@{N="Storage Used (GB)";E={
$sum = Get-Datastore -RelatedObject (Get-VMHost -Location $_) |
where {$_.ExtensionData.Summary.MultipleHostAccess -and $_.Type -eq "VMFS"} |
Measure-Object -Property CapacityGB,FreeSpaceGB -Sum
[Math]::Round($sum[0].Sum - $sum[1].Sum,2)
}} |
Export-Csv c:\scrpits\xxxxx.csv -NoTypeInformation -UseCulture