Welcome to MacForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Q: How to save as CSV in Excel

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  Mobileme won't sync  
Author Message
Johan1

External


Since: Jul 20, 2003
Posts: 11



(Msg. 1) Posted: Thu Nov 06, 2008 6:26 pm
Post subject: Q: How to save as CSV in Excel
Archived from groups: alt>comp>lang>applescript (more info?)

How can I save an Excel spreadsheet as .csv with a semicolon, instead of
comma, delimiter?

When I save the spreadsheet in Excel as CSV the file is saved with
semicolon delimiter and text in double quotes. This allows for
end-of-line characters to be properly imported. The latter in the
destination iPhone app: CSV Touch.

Tab or comma separated doesn't preserve the end-of-line chars en so a
field with EOL gets spread over multiple lines instead of one field.

Maybe it's off-topic but the microsoft AS doc didn't help much either.
(
http://download.microsoft.com/download/3/A/7/3A70FB4B-0C6A-43E3-AAB7-AC9
166B25632/Excel2004AppleScriptRef.pdf )

I hope someone in this AS group can help me out.


The following script saves a comma-separated CSV file:
<appleScript>
-- select the spreadsheet (only Excel 2008 filetype, XLS8)
set theSpreadsheet to (choose file with prompt "Choose the spreadsheet
to be published..." of type "XLS8")

set theInfo to the info for theSpreadsheet
set theFilename to name of theInfo

-- open the spreadsheet and save as CSV file
tell application "Microsoft Excel"
open workbook workbook file name theFilename
--save active workbook in "gelezen.csv" as CSV
save as active sheet filename "gelezen.csv" file format CSV

--tried to set delimiter and text file delimiter semicolon
--but these seem to only pertain to imported files

--none of these file fomats do the trick:
--file format CSV Mac
--file format CSV MSDos
--file format CSV Windows
--file format XML spreadsheet
--file format DBF2
--format DBF3
--format DBF4
--workbook
--"international add in" -- doesn't work
--text windows
--SYLK
--text Mac -- tab delimited
--text MSDos
--works
close active workbook saving no
end tell
</appleScript>

--
_____________________________________
Ing. Johan van Oostrum
chaos geordend - www.chaosgeordend.nl
_____________________________________

 >> Stay informed about: Q: How to save as CSV in Excel 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Excel script to save as CSV - I have been pounding my head over this one for a couple of weeks. I've been playing with it a few minutes a day. I am simply trying to drop an ..xls file on my script and have it save the dropped script in the same directory as the original as a .csv....

XPress "save as WORD" - hello all, how to save selected text of my doc in Word file format save text of selection in lefichier as "TEXT" --> save the text using XPress Tags filter save text of selection in lefichier as "TEXT" --> save selection as t...

Appleworks "Save as" dialog - I want to save an Appleworks drawing document as a JPEG. I say: <font color=purple> ; save front document in (File_Path as alias) as file type "JPEG"</font> (having prepared "File_Path" appropriately). The prob...

Netscape Unique 'Save'??? - Dear all, Unfortunately my scripting is not that great so I was hoping somebody would please be able to help answer/solve the following simple scripting question. I am simply trying to script "Netscape" to save an image file (the only image o...

Why can't any browser save a displayed JPG via AS? - Hi: I've tried Safari, Camino and OmniWeb, and I can't get any of them to save a JPG that is loaded in the browser window to disk. The dictionaries generally have something like: Camino: save v : Save an object. save reference : the object for the..
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]