Hi,
I'm attempting to upload a CSV file to SQL server database on Appian V23.2
The database table has been an existing one for the upload process which was originally an Excel document which got converted to CSV within the process model. We're in the middle of changing this to do straight upload of CSV file.
Issue we are having is that the CSV column names are produced from a third party site (Salesforce) and cannot easily rename the column names to match the database table names.
sample CSV Column names:
sample database table names
OPPORTUNITY_ID | ACCOUNT_NAME | STAGE | OPPORTUNITY_OWNER
Using the "import CSV to Database" smart service, it seems that both have to match if the file is headered. No ability to have different csv column names to that on the database, even if the number of columns match.
I've tried setting 'File has Header' to true and leaving both 'Database Field Names' and 'CSV Header Names' blank but nothing is written to the table, no error returned either. Similarly with 'Column Names'
Is there a way to import a csv file to a database table without having to manually rename the CSV columns to be that of the database?
Thanks,
John
Discussion posts and replies are publicly visible
just in case anyone else faces the same problem. Two major things.
1st topic
The names of the CSV columns and the table fields don't need to match. What needs to match is the number of CSV columns you want to import and the number of target columns. So, CSV header names and Database field names must match or map. This works for me when the attribute File has header = true.
2nd topic AND THE MOST IMPORTANT.
Both attributes CSV header names and Database field names ARE TEXT ARRAYS. If you don't set the name of the csv fields and tables as an array, but as a simple string, you get the error java.lang.IllegalArgumentException: None of the columns from the CSV file matched the database table "YOUR_TABLE_NAME"
so, This fails : "field_a,field_b,field_c"
This doesn't {"field_a","field_b","field_c"}
Cheers.