Is it possible to upgrade from El Capitan to Sierra if you have the pkg and pfpkg files?
Only if you know the exact location of the files for 10.12.6, the last available version.

From your link...


  Update: Here, we have mentioned the URL of the package file for macOS
  10.12. If the latest version of macOS Sierra available on the Mac App Store is a different one, MAS will fetch it from a different location.
  Hence the workaround mentioned here will not work, unless you know the
  URL of the latest package file and create the directory structure on
  localhost based on the same.


It's always wisest to download any major new version from the App Store - any time between when it's released &amp; when it's taken down - even if you never install it. That way it will always be in your purchase history &amp; you can get it again at any time.