Programs are always copied. In fact, there's no guarantee the entire program is ever read into memory as the OS may page in the portions that are needed as they are called for.
Data files are usually opened. Which means the program can read and optionally write to the file (there are usually a read-only open and a read/write open commands). Nowadays, what happens with an open data file will vary:
- Some will copy the file via a read-only open to a temp file that has read/write access, do the manipulation on the temp file, and when the file is closed will delete the read-only version and rename the read/write version to the original file name. I'm not sure of any apps that do this but the tell-tale would be a temp file of similar size to the main file.
- Some will also use a temp file but will write net changes to it. When the file is saved/closed the changes in the temp file are incorporated into the main file. I think Word does this as it's temp files are small.
- Some will read in the file, operate on it in memory, and write out the changed file when it is saved/closed (and possibly periodically as well). I think Excel does this since I haven't noticed a temp file that matches an open file (though I haven't look hard for one).
- Some will manipulate the data file directly, applying changes as they are made. This is normally true with the data files can grow to be large and other forms of manipulation have distinct performance penalties. Most database apps do this. Hopefully they maintain a separate net change or transaction file (SQL Server does a log file, for instance).
- I've not heard of any app that actually reads the file & deletes it then writes an entirely new file upon saving. Not that it wouldn't happen but it'd be a poorly designed app since the data file would be lost if the machine were to lock up or reboot without warning.