View Single Post
 
Old 07-06-2021, 08:45 AM
Voljen Voljen is offline Mac OS X Office 2016 for Mac
Novice
 
Join Date: Jul 2021
Posts: 2
Voljen is on a distinguished road
Default Again Mail Merge from multiple sheet (MAC)

Hello, everyone. I have tried to follow the various tips in the forum, but I cannot solve my problem.
I have an excel file containing multiple sheets. In the same directory I have a word file which I use to generate the final documents.
In the excel file the sheets are called "Sheet1" and "Sheet2".
In the word file the template completes correctly with the data it extracts from Sheet1. Now I would like to insert the data from Sheet2, but I keep having problems.
I'm on Mac, in case this might have some impact on the query to be generated.

I have tried making the following query:
{ DATABASE \d"{FILENAME \p}/../filename" \s " SELECT * FROM [Sheet2$] WHERE [ID Name] = { MERGEFIELD ID_Name } " \l "15" \b "49" \h }
Basically, I wanted the query to go back to the path of the excel file from the path of the word file, select all the fields in Sheet2 where the column with the "ID Name" header was equal to the analysed "ID_Name" value used in word.

1) Unfortunately, the relative link doesn't seem to work, so I modified the path by putting the absolute address, and so I can start to do some tests... Even if I don't understand how to solve this first problem!

2) It doesn't select Sheet2, but automatically takes Sheet1... Here too I don't understand why.

3) The query returns an error, unless I delete "WHERE [ID Name] = { MERGEFIELD ID_Name }". So at least it returns results, but not filtered (and especially from Sheet1, as mentioned above

Does anyone have any ideas on how I could fix this?

Thanks
Reply With Quote