I’m kind of new to anything scripting when it comes to other applications, so I’m looking for a bit of help, or at least a point in the right direction.
What I want to do is take an excel file which has a bunch of product types in, plus all the related information in the rows after it, i.e. product name followed by product size material etc. The filter this file and split it down by product type and save a CSV of each of the product types that I’ve filter on.
The solution doesn’t even have to be excel, I’ve been reading that text wrangler might be an easier script option for this, but I’ve not got the first clue.
Can anyone help?
Well it isn’t hard to achieve at all in excel.
There is only 1 thing you can’t do and that is just simply copy the cell values to csv. csv has normal values and quoted values. Those quoted values are neccesary if the text contains a double quote or and ‘;’ sign. So you should use something like this
tell application "Microsoft Excel" to set cellValue to value of row 5 of column 2 of worksheet 1 of workbook 1
if cellValue contains ";" or cellValue contains "\"" then
set cellValue to quotedCSVFormOf(cellValue)
return cellValue --this value is ready to put in a csv file.
set AppleScript's text item delimiters to "\""
set theTextItems to every text item of theString
set AppleScript's text item delimiters to "\"\""
set theString to theTextItems as string
set AppleScript's text item delimiters to ""
return "\"" & theString & "\"" as string
Thanks for the reply DJ, how do I go about doing this for multiple products though?
This would work fine to fine what ever is in the selected value column, or have I got that wrong?
The line … value of row 1 of column 1 … just get the value of that particular cell, so it’s not from a selected cell.