Computer >> คอมพิวเตอร์ >  >> ซอฟต์แวร์ >> Office

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

ในบทความนี้ ผมจะพูดถึงวิธีการแปลงไฟล์ CSV เป็นไฟล์ excel ที่มีหลายคอลัมน์ (.xlsx รูปแบบ). เนื่องจากไฟล์ CSV นั้นใช้งานง่ายและเปิดได้ด้วยแอปพลิเคชันทั่วไป เราจึงมักได้รับข้อมูลใน .csv รูปแบบ. ต่อมา เนื่องจากการคำนวณเพิ่มเติมหรือการแสดงข้อมูลที่ดีขึ้น เราจึงต้องแปลงไฟล์ CSV เป็นไฟล์ excel มาดูบทความเพื่อเรียนรู้การแปลง CSV เป็น excel กัน

คุณสามารถดาวน์โหลดแบบฝึกหัดที่เราใช้ในการเตรียมบทความนี้ได้

ไฟล์ CSV คืออะไร

CSV ย่อมาจากค่าที่คั่นด้วยจุลภาค นี่คือรูปแบบไฟล์ข้อความธรรมดาที่คั่นข้อมูลด้วยเครื่องหมายจุลภาค คุณสามารถเปิดไฟล์ CSV โดยใช้โปรแกรมแก้ไขข้อความอย่างง่าย เช่น Notepad . นอกจากนี้ เราสามารถเปิดไฟล์ CSV ผ่านแอปพลิเคชันสเปรดชีต เช่น Excel หรือ Google ชีต .

ไฟล์ Excel คืออะไร

ไฟล์ Excel ที่สร้างจาก Microsoft Excel ส่วนใหญ่มี .xlsx นามสกุลไฟล์. ไฟล์เหล่านี้สามารถเปิดได้ผ่านซอฟต์แวร์สเปรดชีต เช่น Google ชีต , เปิดสำนักงาน , หรือ Microsoft Excel . ต่างจากไฟล์ CSV คุณสามารถทำการคำนวณต่างๆ ในไฟล์ excel ได้ นอกจากนั้น ในไฟล์ excel คุณสามารถใช้เทคนิคการแสดงข้อมูลที่หลากหลายเพื่อให้เข้าใจรูปแบบของข้อมูลได้ละเอียดยิ่งขึ้น

5 วิธีในการแปลง CSV เป็น Excel ด้วยคอลัมน์

1. ใช้ตัวเลือก 'บันทึกเป็น' เพื่อเปลี่ยนไฟล์ CSV เป็น Excel

สมมติว่าเราเปิดไฟล์ CSV ด้านล่างด้วย Notepad . ข้อมูลในไฟล์ด้านล่างถูกแยกออกเป็นหลายคอลัมน์ อย่างไรก็ตาม เราจะเห็นเฉพาะค่าที่คั่นด้วยเครื่องหมายจุลภาคใน Notepad .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

ตอนนี้ ฉันจะแปลง CSV ไฟล์ลงในไฟล์ excel ทำตามขั้นตอนด้านล่างเพื่อทำงาน

ขั้นตอน:

  • ขั้นแรก อย่าเปิดไฟล์ CSV ให้คลิกขวาที่ไฟล์แล้วไปที่เปิดด้วย> Excel .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • ด้วยเหตุนี้ ไฟล์ CSV จึงเปิดขึ้นใน Microsoft Excel . ถัดไป จาก Excel Ribbon ให้คลิกที่ ไฟล์ แท็บ

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • ไปที่ ไฟล์ > บันทึกเป็น> เรียกดู .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • จากนั้น บันทึกเป็น กล่องโต้ตอบปรากฏขึ้น ที่นี่ ไปที่ตำแหน่งที่คุณต้องการบันทึกไฟล์
  • หลังจากนั้น ให้ ชื่อไฟล์ แล้วเลือกบันทึกเป็นประเภท : สมุดงาน Excel (*.xlsx) . กด บันทึก เมื่อคุณเสร็จสิ้นกระบวนการ

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • สุดท้าย คุณจะเห็นไฟล์ CSV ด้านบนถูกแปลงเป็นไฟล์ Excel คุณสามารถดูข้อมูลถูกแยกออกเป็นคอลัมน์ ต่อมา จัดรูปแบบข้อมูลตามความต้องการของคุณ

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

2. แทรกตัวเลือก 'ข้อความเป็นคอลัมน์' เพื่อแปลง CSV เป็น Excel ด้วยคอลัมน์

คราวนี้ฉันจะแปลงข้อมูลไฟล์ CSV เป็นหลายคอลัมน์ใน excel ที่นี่ ฉันจะใช้ฟังก์ชัน text to column ใน excel เพื่อแปลงข้อมูลคอลัมน์เดียวเป็นหลายคอลัมน์

ขั้นตอน:

  • เริ่มแรก เปิดไฟล์ CSV ด้วย excel
  • ถัดไป เลือกคอลัมน์ (คอลัมน์ A ) ที่มีค่าคั่นด้วยเครื่องหมายจุลภาค

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • ตอนนี้ ไปที่ ข้อมูล > ข้อความเป็นคอลัมน์ .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • ด้วยเหตุนี้ ตัวช่วยสร้างการแปลง ข้อความเป็นคอลัมน์ ปรากฏขึ้น คลิกที่ คั่น แล้วกด ถัดไป .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • ทำเครื่องหมายที่จุลภาค เมื่อวิซาร์ดตัวต่อไปปรากฏขึ้น กด ถัดไป อีกครั้ง

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • จากนั้นเลือก ปลายทาง ตำแหน่ง แล้วกด เสร็จสิ้น .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • ด้วยเหตุนี้ เราจะได้ผลลัพธ์ด้านล่างใน excel

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • แม้ว่าข้อมูลของเราจะถูกแยกออกเป็นคอลัมน์ในขณะนี้ แต่ยังคงเป็นไฟล์ CSV ในการแปลงไฟล์เป็นไฟล์ excel เราต้องบันทึกไฟล์เป็น .xlsx รูปแบบ. โดยไปที่ไฟล์ > บันทึกเป็น > เรียกดู (ดู วิธีที่ 1) .
  • เมื่อ บันทึกเป็น dialog appears, type the File Name and choose the .xlsx file format, and press Save (see Method 1 )

อ่านเพิ่มเติม: How to Convert CSV to XLSX Command Line (with Easy Steps)

3. Convert CSV to Excel Files Using ‘From Text/CSV’ Feature

I will import a CSV file into excel using the ‘From Text/CSV ’ feature in this method. Later, I will save the data as an excel file with columns. Follow the below steps to do the task.

ขั้นตอน:

  • Firstly, open Excel and go to Data> From Text/CSV icon .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Next, the Import Data dialog will appear. From there, select the CSV file that you want to import and press Import .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Consequently, the CSV file is imported into excel as below. Now, click on Load .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • As a result, we can see the data from the CSV file is loaded as in the below table.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Click on the table, and thus the Table Design tab appears.
  • Go to Table Design> Convert to Range .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Excel will prompt the below warning, press OK .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Upon clicking OK , we will get the below range. If you want you can clear the cell formatting by going to Home> Editing > Clear > Clear Formats .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Later you can format the dataset as you like. Go to the File tab to bring the Save ตัวเลือก

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Afterward, click on Save .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • When the Save As dialog come up, give a name to your file and press Save . So, finally, now you have the CSV file converted into an excel file (with columns).

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

Note:

You can get the ‘From Text/CSV ‘ by following the path Data > Get Data> From File > From Text/CSV too.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

อ่านเพิ่มเติม: Excel VBA to Import CSV File without Opening (3 Suitable Examples)

การอ่านที่คล้ายกัน

  • Excel VBA to Read CSV File into Array (4 Ideal Examples)
  • How to Import CSV into Existing Sheet in Excel (5 Methods)
  • Excel VBA:Read a Text File Line by Line (6 Related Examples)
  • How to Import Text File to Excel Using VBA (3 Easy Ways)
  • Excel VBA:Import Comma Delimited Text File (2 Cases)

4. CSV to Excel File Conversion with ‘Legacy Wizard’ Feature

Now I will import a CSV file using the Legacy Wizard from the Get Data ตัวเลือก. Before importing the CSV file, I will show you how you can add the legacy wizard to excel.

ขั้นตอน:

  • After opening Excel , first, go to the File แท็บ

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Then go to Options .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Consequently, the Excel Options dialog shows up. From the dialog, go to Data ตัวเลือก
  • Now put a checkmark on From Text (Legacy) แล้วกด ตกลง .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • As a result, the From Text (Legacy) feature is added to excel. To apply the feature go to Data> Get Data > Legacy Wizard> From Text (Legacy) .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Consequently, the Import Text File dialog appears, choose the CSV file you want to get in excel, and press Import .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • After that, the Text Import Wizard shows up. Here, click on the Delimited , put a checkmark on My data has headers , and press Next .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Put a checkmark on Comma and again press Next .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Press Finish after that.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • As a consequence the Import Data dialog shows up, choose the data destination location, and press OK .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Finally, we can see that CSV data is imported into excel, separated by columns.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Likewise described in Method 3 , we will save the data. To do that, go to the File แท็บ
  • Then go to Save , type a file name and click Save (see Method 3 )

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

อ่านเพิ่มเติม: How to Import Text File to Excel Automatically (2 Suitable Ways)

5. Excel VBA to Transform CSV to Excel with Columns

You can use Excel VBA to convert CSV files into excel files with multiple columns. Suppose we have a CSV file in a specified location stated below.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

Now I will convert the CSV file into Excel with columns. Let’s follow the below process to do the task.

ขั้นตอน:

  • Open Excel , and go to Developer > Visual Basic to bring the VBA หน้าต่าง

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • When the VBA window appears, go to Insert> Module .

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Then, type the below code in the newly opened Module . Save the file and run the code using the F5 ที่สำคัญ
Sub Convert_CSV_to_EXCEL()

Dim w As Workbook
Set w = Workbooks.Open("C:\Users\User\OneDrive\Desktop\ExcelDemy\How to Convert CSV to Excel with Columns\CSV FIle.csv")
w.SaveAs Filename:="C:\Users\User\OneDrive\Desktop\ExcelDemy\How to Convert CSV to Excel with Columns\CSV FIle.xlsx", _
FileFormat:=xlWorkbookDefault, _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Upon running the code, you will see the below excel file with multiple columns is created.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

  • Now if you go to the CSV file location, you will see the newly created excel (with .xlsx extension) file too.

วิธีการแปลง CSV เป็น Excel ด้วยคอลัมน์ (5 วิธี)

บทสรุป

In the above article, I have tried to discuss several methods to convert CSV files into excel files elaborately. หวังว่าวิธีการและคำอธิบายเหล่านี้จะเพียงพอที่จะแก้ปัญหาของคุณได้ โปรดแจ้งให้เราทราบหากคุณมีข้อสงสัยใดๆ

บทความที่เกี่ยวข้อง

  • How to Convert CSV to XLSX (4 Quick Methods)
  • Excel VBA to Read CSV File Line by Line (3 Ideal Examples)
  • How to Open Notepad or Text File in Excel with Columns (3 Easy Methods)
  • Excel VBA to Convert CSV File to XLSX (2 Easy Examples)
  • How to Open CSV File in Excel with Columns Automatically (3 Methods)