このPowerShellスクリプトでは、csvファイルをインポートし、nullを '0'に置き換えてこのCSVをエクスポートします。CSVコンテンツをUTF-8にエンコードする
問題は、このcsvファイルの内容とヘッダが、私は何もエンコード
任意の提案を、すべてのタイプのための-Encodingを使用し、ほぼすべてのものを試してみました ヘブライ語
であるということですか?
$propertyTranslation = @(
@{ Name = 'Customer__c'; Expression = { $_.'לקוח' } }
@{ Name = 'Name__c'; Expression = { $_.'שם' } }
@{ Name = 'CheckCount__c'; Expression = { $_.'כמות' } }
@{ Name = 'Deal'; Expression = { $_.'עסקהוזה' } }
@{ Name = 'Amount__c'; Expression = { $_.'סכום' } }
@{ Name = 'Discount__c'; Expression = { $_.'ניסיון' } }
# And so on
)
$csv = Import-Csv C:\Users\alon\Documents\again.csv -Header "Customer__c","Name__c","Deal","Amount__c","CheckCount__c","Discount__c"
$csv | ForEach-Object {
if($_.Customer__c -eq "") { $_.Customer__c = "0" }
if($_.Name__c -eq "") { $_.Name__c = "0" }
if($_.Deal -eq "") { $_.Deal = "0" }
if($_.Amount__c -eq "") { $_.Amount__c = "0" }
if($_.Discount__c -eq "") { $_.Discount__c = "0" }
if($_.CheckCount__c -eq "") { $_.CheckCount__c = "0" }
}
Select-Object -Property $propertyTranslation
$csv | Export-Csv C:\Users\alon\Documents\CheckDealBeforeUpsert.csv -NoTypeInformation -Encoding UTF8
あなたの '$ propertyTranslation'タイプは' system.array'です。代わりに '$ propertyTranslation = @ { 'Customer__c' = 'לקוח'のような[Hash Table](https://technet.microsoft.com/en-us/library/ee692803.aspx)を考えてみてください。 'Name__c' = 'שם'; 'CheckCount__c' = 'כמות'; 'Deal' = 'עסקהוזה'; 'Amount__c' = 'סכום'; 'Discount__c' = 'ניסיון' } '。しかし、 '$ propertyTranslation'をまったく省略すると、あなたのスクリプトが動作すると言えます。 – JosefZ
あなたのフィードバッハのためにありがとう –
あなたは私のコードを見ることができます(最後の行は少し右を取る)私が使用しようとしている - エンコード。 –