New Folder from text file

I have a list of customers and part numbers in excel. How would I read from this excel document or a comma delimited list and create folder structure of customers and part numbers?

Hi,

here an example.
Assuming an open excel file with names in column A and numbers (but text formatted) in column B,
this script asks for a base folder and creates folders basefolder/name/number


set d to POSIX path of (choose folder)
tell application "Microsoft Excel"
	set v to value of used range of active sheet
end tell
repeat with i in v
	do shell script "/bin/mkdir -p " & quoted form of (d & item 1 of i & "/" & item 2 of i)
end repeat

That script worked perfectly thank you!!!

Some of my part numbers contain a forward slash (/). This ends up creating a new folder after the forward slash. How would I tell applescript to ignore the forward slash in the part number?

Instead of ignoring the slashes, you might want to translate them to colons so that they show up as slashes in Finder.

	do shell script "/bin/mkdir -p " & quoted form of (d & item 1 of i & "/") & "\"$(printf %s " & quoted form of (item 2 of i) & " | tr / :)\""

That one could be modified to remove the slashes as well (tr -d /). Or if that is too obtuse, you could do the translation in AppleScript:

repeat with i in v
	set part to switchText from item 2 of i to ":" instead of "/"
	do shell script "/bin/mkdir -p " & quoted form of (d & item 1 of i & "/" & part)
end repeat

(* switchText From: http://bbs.applescript.net/viewtopic.php?pid=41257#p41257
Credit: kai, Nigel Garvey*)
to switchText from t to r instead of s
	local d
	set d to text item delimiters
	try
		set text item delimiters to {s}
		set t to t's text items
		-- The text items will be of the same class (string/unicode text) as the original string.
		set text item delimiters to {r}
		-- Using the first text item (beginning) as the first part of the concatentation means we preserve the class of the original string in the edited string.
		tell t to set t to beginning & ({""} & rest)
		set text item delimiters to d
	on error m number n from o partial result r to t
		set text item delimiters to d
		error m number n from o partial result r to t
	end try
	t
end switchText

If you want to remove the slashes, just use “” instead of “:”.

Model: iBook G4 933
AppleScript: 1.10.7
Browser: Safari 4 Public Beta (4528.17)
Operating System: Mac OS X (10.4)

Thank you again!!!