# Creating a CSV file with "Shift-JIS" encoding

**URL:** <https://forum.uipath.com/t/encoding-shift-jis-csv/5280811>\
**Category:** フォーラム\
**Tags:** question, studio, activities\
**Created:** [September 18, 2025, 5:09am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811 "2025-09-18T05:09:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![u\_e](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@u\_e](https://forum.uipath.com/u/u_e)\
**Post date:** [September 18, 2025, 5:09am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/1 "2025-09-18T05:09:15Z")

</div>

I would like to create a CSV file using the encoding “Shift-JIS.” Could you advise me on how to resolve the error or implement this in the execution environment?

 ・UiPath Studio 2024.10.1 ・Windows-Legacy ・UiPath.System.Activities = 22.4.1 ・UiPath.UIAutomation.Activities = 22.4.9 ・UiPath.Excel.Activities = 2.8.6 ・UiPath.Mail.Activities = 1.8.6

【Errors encountered】  
・When I set Encoding to “Shift-JIS” in “WriteCsvFile” and run it, the following error occurs.  
  
Write to CSV: Method not found: ‘Void CsvHelper.CsvWriter..ctor(System.IO.TextWriter)’

・I tried adding a call to the method described at the following “Reference URL,” but an error occurred and I couldn’t implement it.  
Reference URL: [【UiPath】UiPathで「Shift-Jis」が使えない場合の対処法 #UiPath - Qiita](https://qiita.com/Davoi/items/d890526e0a04a7ddaee1)  
  
Invoke Method  
A compilation error occurred while processing the expression “System.Text.CodePagesEncodingProvider.Instance”. A reference to the assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’, which contains the base class ‘System.Text.EncodingProvider’, is required. Please add the reference to the project.

・I also tried creating a CSV file using Invoke Code, but got the error “‘shift\_JIS’ is not a member of Encoding,” so I couldn’t create the CSV file.

---

<div class="post-metadata">

**Author:** ![bhavesh.choubey](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bhavesh.choubey/32/535427_2.png) [@bhavesh.choubey](https://forum.uipath.com/u/bhavesh.choubey)\
**Post date:** [September 18, 2025, 5:16am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/2 "2025-09-18T05:16:48Z")

</div>

I think the error happens because Write CSV in UiPath doesn’t fully support Shift-JIS in our version. The reliable solution is to use Invoke Code with `StreamWriter` and `Encoding.GetEncoding("shift_jis")`. Other workarounds (registering CodePagesEncodingProvider or converting UTF-8) are less stable in Windows-Legacy.

Cheers

---

<div class="post-metadata">

**Author:** ![u\_e](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@u\_e](https://forum.uipath.com/u/u_e)\
**Post date:** [September 18, 2025, 5:35am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/3 "2025-09-18T05:35:50Z")

</div>

Thank you for your response.  
By the way, if I were to use Invoke Code, would it be possible for you to advise me on what kind of code I should write?

---

<div class="post-metadata">

**Author:** ![bhavesh.choubey](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bhavesh.choubey/32/535427_2.png) [@bhavesh.choubey](https://forum.uipath.com/u/bhavesh.choubey)\
**Post date:** [September 18, 2025, 5:42am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/4 "2025-09-18T05:42:59Z")

</div>

Hey @u_e try this

```auto
Dim enc = System.Text.Encoding.GetEncoding(932) ' Shift-JIS

Function EscapeCsv(v As String) As String
    If v Is Nothing Then Return ""
    If v.Contains(","c) OrElse v.Contains(""""c) OrElse v.Contains(vbCr) OrElse v.Contains(vbLf) Then
        v = v.Replace("""", """""")
        Return """" & v & """"
    End If
    Return v
End Function

Using sw As New System.IO.StreamWriter(in_FilePath, False, enc)
    ' Header
    sw.WriteLine(String.Join(",", in_DataTable.Columns.Cast(Of System.Data.DataColumn).Select(Function(c) EscapeCsv(c.ColumnName))))
    ' Rows
    For Each r As System.Data.DataRow In in_DataTable.Rows
        sw.WriteLine(String.Join(",", r.ItemArray.Select(Function(f) EscapeCsv(If(f, "").ToString()))))
    Next
End Using

```

It is not tested because it is AI generated please try and do the modification if needed  
Also make sure these are the Arguments  
`in_DataTable` (In, System.Data.DataTable) and `in_FilePath` (In, String)

Cheers

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [September 18, 2025, 6:31am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/5 "2025-09-18T06:31:26Z")

</div>

Hello

I think this error may be due to a version mismatch in the activity package dependencies.

Would it be possible to upgrade Excel.Activiites.Package to a higher version?

> I tried adding a call to the method listed in the “Reference URL” below, but

This is about a Windows project, so I don’t think it’s relevant to Windows Legacy.

---

<div class="post-metadata">

**Author:** ![u\_e](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@u\_e](https://forum.uipath.com/u/u_e)\
**Post date:** [September 18, 2025, 7:01am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/6 "2025-09-18T07:01:24Z")

</div>

Thank you for your response.

> Would it be possible to upgrade Excel.Activiites.Package to a later version?

Due to the constraints of our development environment, it would be difficult to upgrade to a later version.  
We would like to proceed with development using the current version.

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [September 18, 2025, 7:15am UTC](https://forum.uipath.com/t/encoding-shift-jis-csv/5280811/7 "2025-09-18T07:15:17Z")

</div>

This is likely caused by an issue between the dependencies of the System.Activites package and those of the Excel.Activites pacakge. To resolve the issue with the CSV writing activity, you may need to change the activity package versions (either upgrade EXCEL or downgrade System).

As a workaround, you could try outputting the DataTable as a string using the Output DataTable activity, then writing it to a file with the WriteTextFile activity.
