AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FileAppend With Excel Doesn't Work

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Jeremiah



Joined: 20 Apr 2009
Posts: 797
Location: North Dakota, USA

PostPosted: Fri Jan 29, 2010 7:55 pm    Post subject: FileAppend With Excel Doesn't Work Reply with quote

I am having trouble getting this to work. So far, the script does create the file "test.xlsx" and opens it, but for some reason Excel doesn't like it. Any thoughts?

Code:
FileAppend, , C:\test.xlsx
Run C:\test.xlsx

I have also tried this with putting in some text too, but it still doesn't work.

Thank you in advance!
_________________
-Jeremiah
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Jeremiah



Joined: 20 Apr 2009
Posts: 797
Location: North Dakota, USA

PostPosted: Fri Jan 29, 2010 9:08 pm    Post subject: Reply with quote

Anyone?
_________________
-Jeremiah
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Carcophan



Joined: 24 Dec 2008
Posts: 1308
Location: :noitacoL

PostPosted: Fri Jan 29, 2010 9:27 pm    Post subject: Reply with quote

I use:

FileAppend,`n%var% `, %var% `, %var% , C:\path\path\ExcelDocuments.csv


the `, is for the comma, as 'CSV' is comma seperated variables, and inputs values into the different columns.

the csv files open with XLS.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Jan 29, 2010 9:51 pm    Post subject: Reply with quote

Excel files are binary files which you can deal with in AHK as such (you can but you don't want to go there). FileAppend works for text files, like CSV for example. So you could export your Excel file to CSV and add data to it via the fileappend command but it won't work for XLS files.

If you do want to work with Excel files directly you need to look into COM
http://www.autohotkey.com/forum/viewtopic.php?t=31923
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
answer4u
Guest





PostPosted: Fri Jan 29, 2010 9:53 pm    Post subject: Reply with quote

Jeremiah wrote:
I am having trouble getting this to work. So far, the script does create the file "test.xlsx" and opens it, but for some reason Excel doesn't like it. Any thoughts?

Try opening a .xlsx file with notepad and you might see why Wink . As Carcophan pointed out, you could convert these files to .csv files, or you could open them with excel to append.
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jan 29, 2010 11:08 pm    Post subject: Reply with quote

xlsx files are actually zip files. One of the better MS standards is the zip container file formats. Rename an xlsx file to .zip, then open it up and have a look. inside you can find all your data in xml format, though it's not always easy to read.


as far as making files, csv is really the right way to go. any spreadsheet program will read it, and all your data will import cleanly.

remember to put "" around text fields. commas inside " are read as commas and not column separators.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
Carcophan



Joined: 24 Dec 2008
Posts: 1308
Location: :noitacoL

PostPosted: Fri Jan 29, 2010 11:22 pm    Post subject: Reply with quote

engunner wrote:
Rename an xlsx file to .zip, then open it up and have a look. inside you can find all your data in xml format,



...wow Shocked

Neat trick, had absolutly NO idea that was even possible.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group