Extract specific cell data from csv file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
shgilad81
Posts: 10
Joined: 15 Nov 2017, 14:08

Extract specific cell data from csv file

22 Nov 2017, 13:10

Can someone please give me direction how to extract specific cell data from csv file and use it to create folder named by the same data.
For example: csv file has a cell with a date and I want to use it to create a folder.

Thanks you
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Extract specific cell data from csv file

22 Nov 2017, 16:04

Read the file into a variable, then use nested loops that will parse the file until you get to the line you want (outer loop) and the item on that line (inner loop). Use Loop, Parse, with CSV as the delimiter for the inner loop.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Extract specific cell data from csv file

22 Nov 2017, 16:59

Code: Select all

ColumnNr := 4
delimiter := ";"
Loop, Read, My.csv
   {
   Cell := StrSplit(A_LoopReadLine,delimiter)
   MsgBox % Cell[ColumnNr]
   }
Not tested.
garry
Posts: 3763
Joined: 22 Dec 2013, 12:50

Re: Extract specific cell data from csv file

22 Nov 2017, 17:51

For example: csv file has a cell with a date and I want to use it to create a folder.
idea , this is a script from 'BoBo'
read first row/column-4 and creates a folder at desktop

Code: Select all

;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=40358 ---
f1=%a_scriptdir%\my.csv
ifnotexist,%f1%
{
e4x=
(
aaa;bbbb;ccc;ddd1;eee
aaa;bbbb;ccc;ddd2;eee
)
fileappend,%e4x%,%f1%
}

ColumnNr := 4
delimiter := ";"
Loop, Read,%f1%
   {
   Cell := StrSplit(A_LoopReadLine,delimiter)
   aa:=Cell[ColumnNr]
   ;MsgBox % Cell[ColumnNr]
   break
   }
filecreatedir,%a_desktop%\%aa%
return
User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Extract specific cell data from csv file

25 Nov 2017, 03:04

"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
shgilad81
Posts: 10
Joined: 15 Nov 2017, 14:08

Re: Extract specific cell data from csv file

25 Nov 2017, 08:54

Thank you all. You gave me the direction I needed.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada and 267 guests