KingdomFirst / Bulldozer

A multi-component Windows app to convert data into Rock RMS from other church management systems.
https://www.rockrms.com/
Apache License 2.0
8 stars 9 forks source link

B: Cannot open source file #81

Closed apull closed 1 year ago

apull commented 1 year ago

I'm trying to upload a CSV for import, and cannot get the file to upload on the initial screen.

I get the error: "Could not open source file. Please make sure the file is not in use.

If I upload the sample CSV files included with bulldozer, they open just fine. If I open the sample file in Bulldozer in notepad and replace the data with my own, I get the error.

I have checked permissions, and of course have verified the files are not over. I have tried different encodings, everything I can think of, and it still refuses to open the source file. I have saved the source file in various directories, including the directory in which I have Bulldozer installed, and also the directory where the SampleCSV files are located.

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Load Bulldozer
  2. Choose CSV File
  3. Click "Upload"
  4. Select CSV File and hit open.
  5. Error pops up.

Context

ZenyaTest5.csv

guymaness2 commented 1 year ago

@apull We have not had any issues importing csv files. With the error you are seeing, try the following: 1) Make sure your target csv file is not open in, or being accessed by any other program or application before launching Bulldozer. 2) Be sure to run the Bulldozer.exe program as administrator

apull commented 1 year ago
  1. Definitely verified the file is not open or being accessed.
  2. Definitely running Bulldozer.exe as administrator.

Is there something else other than a file lock that could cause this? Would a formatting issue throw this same error? Is there a specific necessary file encoding that is needed? I've tried saving from Notepad, LibreOffice, Numbers, and Excel.

apull commented 1 year ago

Update: I didn't realize that I needed to name the file exactly 01 - Individuals.csv in order for it to work.

guymaness2 commented 1 year ago

@apull Ah, good catch. It is actually just the "Individual.csv" part that matters. On all of the csv files, Bulldozer detects the file based on the "datatype" keyword being the last part of the file name. Anything before it is arbitrary. For example, the individual file can be named "xxxxxxxx-yyyyIndividual.csv" and it will detect it. The numbered pre-fixes in our examples are just for file system sorting. More specifically, it is looking for file names that end with one of these key datatype names: https://github.com/KingdomFirst/Bulldozer/blob/master/Bulldozer.CSV/CSVInstance.cs#L32-L63. It does this using an EndsWith on the filename of the uploaded file(s). https://github.com/KingdomFirst/Bulldozer/blob/master/Bulldozer.CSV/CSVComponent.cs#L619