Sign in to follow this  
Followers 0
AutoCraig

Excel Data to MS Word Fields

7 posts in this topic

Is there a way I could take a Excel Spreadsheet and populate a document with the data from the spreadsheet dumped in a certain format? For Example:

If I had a spreadsheet of data:

ColumnA ColumnB ColumnC

Data0 More Data0 Even More Data0

Data1 More Data1 Even More Data1

Data2 More Data2 Even More Data2

I want to populate a document with that data in a certain way:

Data0

More Data0 Even More Data0

Data1

More Data1 Even More Data1

Data2

More Data2 Even More Data2

I know how to store excel data to an array (_ExcelReadArray) and I know I can painfully open a new word doc and format it. I was hoping that I could just populate some unique fields over and over again.

I know my formatting in this post won't come out nice, but I hope I got the idea across.

Share this post


Link to post
Share on other sites



Hi, AutoCraig. Have you looked into using _ExcelReadCell? You can always read the cells into variables, then dump them into your Word doc in whatever fashion you'd like.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Dumping it willy nilly into a word doc was what I was trying to avoid. There would be potential to have lots of data and I don't want a word doc sitting there filling in data for 5 mins.

Share this post


Link to post
Share on other sites

There is an Excel UDF and a Word UDF built into AutoIt. You can access the objects created/returned by this UDFs using pure AutoIt and do what you need.

Have a look at MSDN to get a reference of the Word COM.

You are a bit vague in your description what you want to do. Some more information is needed to really help you. Like:

  • What amount of data are we talking about? How big is your Excel file?
  • What do you mean by "populate some unique fields"?
  • Do you have a word template that needs to be filled or do you want to create the document froms cratch?
  • ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Could you attach a sample Excel and Word documents so that we better understand your requirements?

Edit: What water said ^

Edited by big_daddy

Share this post


Link to post
Share on other sites

Sorry for the vagueness. I didn't know about the Word UDFs, that should do it. Thanks for the help.

Share this post


Link to post
Share on other sites

I'm not sure if the Word UDF supports you in more than opening a document and returning the object. Inserting text/data has to be done by you using the returned object.

Check the functions of the Word UDF and if you have further questions describe what you want to do as detailed as possible.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0