Are you talking about having users upload the xml or csv files to the site and having the files read and data inserted into the database? You would need a form with file upload capability. In the form model you could restrict file types to .xml or .csv, and based on the extension your controller action would use string or simpleXML methods to read the information and save the data. These methods would have to check for missing fields, and valid foreign keys, etc.
I am not an expert and I would be nervous about this type of user activity. I would have authorized users adding data with the create methods based on gii generated CRUD with the model’s rules applied. This limits entry to one row at a time but is more secure.
Sorry for the long delay, I had a flu that put me on my back for a while.
There are different ways to accomplish what you’re looking to do. You can have a separate file upload form model & form view, using SiteController to process the files, or you could have ‘file’ as one of your attributes of the model(s) you’re working with. The Yii2 documentation on file upload will help you if you just want to make a simple file upload model which would probably be easier.
Look up SimpleXML for parsing the XML files. The CSV files would require php string manipulation.