Hello, Scott!
Try this one. It should save worksheets in CSV files with overwriting existing ones. Don't know about saving in UTF-8.
Maybe you just can use 'iconv' for encoding conversions.
set excelDirectory to "Macintosh HD:Users:scott:Downloads:Excel:"
set outputDirectory to "Macintosh HD:Users:scott:Downloads:Excel:converted"
tell application "Microsoft Excel"
set theWorkbook to open workbook workbook file name (excelDirectory & "excel.xls")
set maxCount to count worksheets of theWorkbook
repeat with i from 1 to maxCount
set theWorksheet to worksheet i of theWorkbook
set worksheetName to name of theWorksheet
save as theWorksheet filename (outputDirectory & ":" & worksheetName & ".csv") file format CSV file format with overwrite
end repeat
close theWorkbook saving no
end tell
15 June 2011, 13:05 letter from Scott Wilcox <
email@hidden>:
Hi folks,
I've written an Applescript that is almost working how I want it to. There are a couple more things that I can't seem to get quite right.
-- Paths to Excel file and output directory
set excelDirectory to "Macintosh HD:Users:scott:Downloads:Excel:"
set outputDirectory to "Macintosh HD:Users:scott:Downloads:Excel:converted"
tell application "Microsoft Excel"
activate
set theWorkbook to open workbook workbook file name excelDirectory & "excel.xls"
set maxCount to count of worksheets of theWorkbook
repeat with i from 1 to maxCount
set theWorkbook to open workbook workbook file name excelDirectory & "excel.xls"
set theWorksheet to worksheet i of theWorkbook
set worksheetName to name of theWorksheet
activate object worksheet worksheetName
save as theWorksheet filename (outputDirectory & ":" & worksheetName & ".csv") file format CSV file format
close active workbook
end repeat
end tell
The script runs through and processes the files and exports them to CSV. However, I need to UTF8 encode the files and preferably prevent the 'save changes' prompt from happening (I'd just like to overwrite any files that are there). Suggestions most welcome!
+44 (0) 7538 842418 | +1 (646) 827-0580
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives:
http://lists.apple.com/archives/applescript-users
This email sent to
email@hidden