You can't bypass the Mac's internal disk to transfer files from the external drive to iCloud.
iCloud is a feature used to sync the data across your Apple devices signed in with the same Apple ID. If you want to upload the files from an external hard drive to iCloud, you have to first import them to your Mac and then sync them with iCloud. Even if you can directly drag-drop the files from the external hard drive to iCloud Drive in Finder's sidebar, this syncing service by default keeps a local copy on your Mac drive taking up your local disk space.
After you have synced the imported files to iCloud, if you delete the files transferred from the external hard drive, they will also be deleted from iCloud, and you won't be able to access them on other synced devices.