U beddelo CSV una beddelo Excel (XLS ama XLSX) adoo isticmaalaya khadka taliska ee Windows

Halkan waxaa ah tabobar si loogu beddelo CSV ilaa XLS ama XLSX iyadoo la adeegsanayo khadka taliska (convert CSV to XLS or XLSX using the command-line) gudaha(interface) Windows Windows 11/10 . Waxaa jira siyaabo badan oo loogu badalo faylka CSV qaabab Excel ( XLS , XLSX ). Waxaad isticmaali kartaa Microsoft Excel , freeware beddelka u go'an, ama qalab online ah si aad u samayso beddelka. Laakiin, ma ogtahay inaad sidoo kale isticmaali karto interface-line interface Windows si aad (Windows)CVS ugu beddesho Excel ? Oo, xitaa uma baahnid wax qalab dhinac saddexaad ah taas? Haddaysan ahayn, casharradani waxay kuu noqon doontaa mid aad la yaab leh.

Maqaalkan, waxaan ku tusi doonaa sida aad ugu beddeli karto faylka CSV buug- (CSV)shaqeedka Excel(Excel) . Taas awgeed, waxaan isticmaali doonaa VBScript . Aynu eegno qoraalka iyo tillaabooyinka aad u baahan tahay beddelka.

Sida CSV loogu beddelo Excel iyadoo la adeegsanayo khadka taliska(Command)

Waa kuwan tillaabooyinka lagu beddelayo CSV loona beddelo Excel iyadoo la adeegsanayo Interface Command Line(Command Line Interface) gudaha Windows 11 ama Windows 10:

  1. Fur notepad.
  2. Qor Script Visual Basic (VBS).
  3. Keydi faylka VBS
  4. Fur Command Prompt galka
  5. Geli(Enter) amarka beddelka CSV ee Excel .

Aynu si faahfaahsan uga wada hadalno tillaabooyinkan!

Marka hore, ka fur codsiga Notepad kaaga Windows 10 PC. (Notepad)Hadda waa inaad qortaa VBScript oo leh amarro la xidhiidha. Hoos(Below) waxaa ku qoran qoraalka oo dhan oo aad u baahan tahay inaad geliso Notepad(Notepad) ; Kaliya ka koobi halkan oo ku dheji Notepad(Notepad) kaaga :

'======================================
' Convert CSV to Excel
'
' arg1: source - CSV path\file
' arg2: target - Excel path\file
'======================================

srccsvfile = Wscript.Arguments(0) 
tgtxlsfile = Wscript.Arguments(1)

'Create Spreadsheet
'Look for an existing Excel instance.
On Error Resume Next ' Turn on the error handling flag
Set objExcel = GetObject(,"Excel.Application")
'If not found, create a new instance.
If Err.Number = 429 Then '> 0
Set objExcel = CreateObject("Excel.Application")
End If

objExcel.Visible = false
objExcel.displayalerts=false

'Import CSV into Spreadsheet
Set objWorkbook = objExcel.Workbooks.open(srccsvfile)
Set objWorksheet1 = objWorkbook.Worksheets(1)

'Adjust width of columns
Set objRange = objWorksheet1.UsedRange
objRange.EntireColumn.Autofit()
'This code could be used to AutoFit a select number of columns
'For intColumns = 1 To 17
' objExcel.Columns(intColumns).AutoFit()
'Next

'Make Headings Bold
objExcel.Rows(1).Font.Bold = TRUE

'Freeze header row
With objExcel.ActiveWindow
.SplitColumn = 0
.SplitRow = 1
End With
objExcel.ActiveWindow.FreezePanes = True

'Add Data Filters to Heading Row
objExcel.Rows(1).AutoFilter

'set header row gray
objExcel.Rows(1).Interior.ColorIndex = 15
'-0.249977111117893

'Save Spreadsheet, 51 = Excel 2007-2010 
objWorksheet1.SaveAs tgtxlsfile, 51

'Release Lock on Spreadsheet
objExcel.Quit()
Set objWorksheet1 = Nothing
Set objWorkbook = Nothing
Set ObjExcel = Nothing

Ka dib markaad gasho qoraalka sare, waxaad u baahan tahay inaad ku kaydiso faylka .vbs faylka kordhinta. Si taas loo sameeyo, dhagsii File > Save As option. Gudaha Save As dialog , u dhig Save As Type to All Files ka dibna geli magaca faylka oo ay ku xigto faylka .vbs . Intaa ka dib, dhagsii badhanka Save si aad u kaydiso faylka VBS .

Hadda, gal gal meesha aad ku kaydisay qoraalka sare ee VBS oo fur Command Prompt galkan(open Command Prompt in this folder) .

Marka xigta, waa inaad gelisaa amar leh syntax hoose ee CMD :

VBSFilename [Input CSV file with path] [Output Excel file with path]

Aynu nidhaahno waxaad u magacawday faylka VBS sida "csv-to-excel", ka dib amarkaagu wuxuu u ekaan doonaa midka hoose:

csv-to-excel C:\Users\KOMAL\Desktop\twc.csv C:\Users\KOMAL\Desktop\twc1.xlsx

Lacalla(xls) haddii aad rabto inaad abuurto faylka Excel oo wata faylka dheeraynta ie, XLS , kaliya ku beddel xlsx xls . Waa kan tusaale:

csv-to-excel C:\Users\KOMAL\Desktop\twc.csv C:\Users\KOMAL\Desktop\twc1.xls

Xusuusnow inaad u baahan tahay inaad sheegto jidka buuxa ee labadaba CSV gelinta iyo soo saarista faylasha Excel .

Sida CSV loogu beddelo Excel (XLS ama XLSX) iyadoo la adeegsanayo khadka taliska gudaha Windows 10

Markaad gasho amarka kore, waxaad heli doontaa faylka Excel ee soo baxa.(Excel)

U beddel CSV una beddel Excel adoo isticmaalaya khadka taliska

VBScript -ka sare , waxaa jira ikhtiyaaro lagu hagaajinayo ballaca tiirka, barafka qaboojinta, buuxinta shaandhada, samee madax geesinimo leh, iwm. Waxaad si fudud u hagaajin kartaa VBScript si aad u habayso xulashooyinkan ka dibna u socodsii amarka si aad CSV ugu beddesho Excel iyada oo loo marayo CMD . Haddii aad tahay barnaamij-sameeyaha, waxaad si dheeraad ah u habeyn kartaa qoraalka si waafaqsan.

Marka, tani waa sida aad CSV(CSV) ugu beddeli karto Excel adoo isticmaalaya Command-Line iyadoo la kaashanayo VBScript uu abuuray Jeff(created by Jeff) .

Akhrinta la xidhiidha:(Related reads:)



About the author

Waxaan ahay windows,ios,pdf, khaladaad, injineer qalabeed leh in ka badan 10 sano oo waayo-aragnimo ah. Waxaan ka shaqeeyay barnaamijyo badan oo tayo sare leh oo Windows ah iyo qaab-dhismeedka sida OneDrive ee Ganacsiga, Office 365, iyo in ka badan. Shaqadaydii dhowayd waxaa ka mid ahaa horumarinta akhristaha pdf ee madal windows iyo ka shaqaynta samaynta khaladaadka fariimaha si cad ugu cad dadka isticmaala. Intaa waxaa dheer, waxaan ku lug lahaa horumarinta madal ios dhowr sano hadda oo aan aad u aqaano sifooyinkeeda iyo quirks labadaba.



Related posts