dpeisenbeisz
09-21-2017, 11:45 AM
I'm sure this has been asked and answered, but I can't seem to find it, and searching for something as generic as "Word Tables" brings up so many posts I could spend all day looking through them. Please point me to the thread or web page that will help me overcome this simple problem.
I know enough about office VBA and other programming languages to be dangerous, but I'm not completely ignorant of this type of programming either. What I am trying to do is pull data from an Excel spreadsheet into a Word (2016) table. The spreadsheet could have anywhere from 3 to 200 rows of data. Each row has the same number of columns, but not all of them will be imported.
I want to be able to enter my data using Excel because it allows me to sort and perform calculations within the data that Word cannot do easily. Once I have the data arranged and calculated, I need to import the important cells of each row into each row of a word table to generate a report.
I've tried to do this using XML, a comma-delimited import, and a mail merge. I am not opposed to any of these solutions. XML works better when importing INTO Excel, not so great the other way around but I still have the same problem. A mail merge works a little better, but I still need to determine the correct number of rows, then insert the rows, then manually populate each row with merge fields, which kind of makes it non-automated.
So, I think a good solution would be some bit of code that will take the second row of my table (the first row is a header) and repeat it for each record (row) in my Excel file. Again, the issue is adding the correct number of rows to a pre-formatted table.
Any thoughts on how to setup a doc template for doing this? Is XML or a merge a better way to go, or something else entirely? I'm not looking for a solution, just a point in the right direction. Thanks.
I know enough about office VBA and other programming languages to be dangerous, but I'm not completely ignorant of this type of programming either. What I am trying to do is pull data from an Excel spreadsheet into a Word (2016) table. The spreadsheet could have anywhere from 3 to 200 rows of data. Each row has the same number of columns, but not all of them will be imported.
I want to be able to enter my data using Excel because it allows me to sort and perform calculations within the data that Word cannot do easily. Once I have the data arranged and calculated, I need to import the important cells of each row into each row of a word table to generate a report.
I've tried to do this using XML, a comma-delimited import, and a mail merge. I am not opposed to any of these solutions. XML works better when importing INTO Excel, not so great the other way around but I still have the same problem. A mail merge works a little better, but I still need to determine the correct number of rows, then insert the rows, then manually populate each row with merge fields, which kind of makes it non-automated.
So, I think a good solution would be some bit of code that will take the second row of my table (the first row is a header) and repeat it for each record (row) in my Excel file. Again, the issue is adding the correct number of rows to a pre-formatted table.
Any thoughts on how to setup a doc template for doing this? Is XML or a merge a better way to go, or something else entirely? I'm not looking for a solution, just a point in the right direction. Thanks.