スキップしてメイン コンテンツに移動

投稿

12月, 2021の投稿を表示しています

Excel Power Query 英数字の全角から半角への変換

最近仕事上でExcelのPower Queryを始めました。しかし、英数字の全角から半角への変換関数がないため、下記のサイトを参考して、 作っちゃいました。  https://qiita.com/baku2san/items/8041d0259fe0db680e7e https://www.yoheim.net/blog.php?q=20191101 (original as text) as text =&gt; let    originalText = Text.Combine({original, ""}),    replaceResult =  Web.Page("<script>var originalText="&"'"&originalText&"'"&";var result=originalText.replace(/[A-Za-z0-9]/g, function(s) {return String.fromCharCode(s.charCodeAt(0) - 0xFEE0);});document.write(result);</script>")       [Data]{0}[Children]{0}[Children],    result = if (List.Count(replaceResult) &lt;= 1) then    {        "" as text // 変換して何も残らない場合    } else if (replaceResult{1}[Text]{0} = null) then    {       originalText   as text// 何も見つからない場合    }  else {       replaceResult{1}[Text]{0} as text    } in     result{0}