I also use Gmail account to transfer contacts from my Samsung Galaxy Note 4 to new iPhone. It indeed convenient.If you had a gmail account you were syncing your contacts from samsung to iPhone. Yes you can. Just add that gmail account under Mail, Contact and Calendars. When it asks about Contacts.. Answer Yes. I think you could also export them all from your web browser, saving them as a file.. Then using your iCloud Address book, upload that file. Either way should work.
Why not learn to attach a link, this will be more detailed about Samsung to iPhone transfer ,Below are main steps that takes place in this contact transfer process. For their complete details go to Samsung S5 Manual-
Step 1: Launch Samsung Galaxy to iPhone Transfer tool, connect your devices to PC
Step 2: Select Contacts to Transfer
Step 3: Start transfer files from Samsung Galaxy to iPhone 6 Transfer.