Read by specifying the CSV column with VBScript
I would like to create a VBScript that outputs to a text file
I don't know what to start with.
I would appreciate any advice.
+ +
From the data.csv below
I want to extract the name column, height column, and weight column and output them to result.txt.
Also, at that time, I want to make the comma a half-width space.
↓ data.csv
ID, name, address, number, height, weight
001, suzuki, 1-1,111,170,80
002, tanaka, 1-2,112,180,80
003, naito, 11-3,113,179,66
From
↓ I want to create result.txt.
name height weight
suzuki 170 80
tanaka 180 80
naito 179 66
I tried to google with "vbs csv column specification" etc.
I couldn't get a result that seemed to be a hint.
I would appreciate any advice.
-
Answer # 1
-
Answer # 2
There are other answers, but you can't read by specifying a column.
Aim for the following processing flow.Open CSV file
Open output file
Loop start
Read one line of CSV file
Exit the loop if the CSV file is EOF
One line read is divided by commas and arranged
Create a string for output by collecting the required columns
Write the output string to the output file
Back to 3
Close CSV file
Close output file
I think you have all the keywords you need, so if you don't understand, please find out for yourself.
Related articles
- csv - i want to extract data corresponding to column name2 from randomword randomly extracted from data corresponding to column1
- [vbscript] edit the contents of csv file
- vbscript - vbs xls → csv convert
- php - i want to specify only one of the same records in one column in the database
- vbscript - i want to output a column as it is with adodb
- vbscript - i want to change the data displayed in the user unit column in csv to date unit using vbs
- aspnet mvc 4 - i want to specify the column order generated by aspnet core 20 scaffolding here, not in alphabetical order
- i want to specify any column in vba and copy it to another sheet
- write sql statement in php and specify year and month from date type column to extract, but parse error occurs
- r - i want to specify a column of data and plot
- i want to extract characters from specific column in csv
- i want to know how to specify a range up to the last row (column) in python excel
- how to specify the final column when flex columns are set in css div i want to delete border
- Python Dataframe specify multiple column deduplication and difference method
- python 3x - i do not understand how to specify column of iloc of dataframe in python
- error "error: no such column:" occurs when you specify a column name in an ordinary select statement in sqlite3
- csv - phpmyadmin column order when exporting
- i want to give a column name to a column that is not specified in csv
- python - how to specify individual column width for pandas dataframe
In the first place, it is impossible to "read by specifying a column", so read all the rows and extract only the necessary columns.
To split a string with commas
split
Use a function.cols = split (data, ",")