Skip to content

Latest commit

 

History

History
24 lines (14 loc) · 1.58 KB

README.md

File metadata and controls

24 lines (14 loc) · 1.58 KB

Excel2Word-Filler

Nothing special. Fills copies of documents with data from excel.

Autogenerated detailed description

The script takes four command-line arguments: the name of the Excel file to read, the name of the Word document to use as a template, the starting row number in the Excel file, and the number of rows to process.

First, the script loads the Excel file and selects the active worksheet.

Then, it opens the Word document and creates a new Document object.

Next, it extracts the header row from the worksheet and finds the positions of all non-empty cells in the header row. These positions correspond to the temporary words that need to be replaced in the Word document.

The script then iterates over the specified rows in the Excel worksheet and checks if any of the cells in the row are non-empty. If at least one cell is non-empty, the script creates a new Document object from the template.

For each temporary word in the header row, the script searches for and replaces all occurrences of the word in the Word document. This includes searching in the main body of the document as well as any tables or sub-tables.

Finally, the script saves the updated document with a new filename that includes the value in the second column of the row being processed.

At the end, the script prints out the number of fields that were replaced in each document that was created.

Note from me

  1. Your template word should not contain special symbols or ubderlines, use only letters
  2. Make shure your template words in Word doc are typed with in one style, so they wont be in different inlines