AutoHotkey Community

It is currently May 27th, 2012, 2:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: January 29th, 2010, 8:55 pm 
Offline

Joined: April 20th, 2009, 1:10 pm
Posts: 817
Location: North Dakota, USA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 29th, 2010, 10:08 pm 
Offline

Joined: April 20th, 2009, 1:10 pm
Posts: 817
Location: North Dakota, USA
Anyone?

_________________
-Jeremiah


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 29th, 2010, 10:27 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 29th, 2010, 10:51 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
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 FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 29th, 2010, 10:53 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 30th, 2010, 12:08 am 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 30th, 2010, 12:22 am 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
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 :shock:

Neat trick, had absolutly NO idea that was even possible.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, engunneer, JSLover, rbrtryn, sjc1000 and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group