• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Excel Sheets to CSV
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Excel Sheets to CSV


  • Subject: Excel Sheets to CSV
  • From: Scott Wilcox <email@hidden>
  • Date: Wed, 15 Jun 2011 10:03:05 +0100

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!

--
Scott Wilcox

@dordotky | email@hidden | http://dor.ky
+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

  • Follow-Ups:
    • Re: Excel Sheets to CSV
      • From: Leonid Bogdanov <email@hidden>
  • Prev by Date: perform command
  • Next by Date: Re: perform command
  • Previous by thread: Re: perform command
  • Next by thread: Re: Excel Sheets to CSV
  • Index(es):
    • Date
    • Thread