Iam trying to execute a query using execute query component then save the output as excel and upload that in a site,while trying to upload the excel it is not getting uploaded if we check log of that website it is showing that special charecter ‘???’ is getting added before the first column heading. If i generate the same excel by copy pasting the content in DB by executing the same query and try to upload it is getting uploaded. Is it problem with the execute query component or with the excel?
May be it adds some extra spaces before the column heading so it might be worthful if you use the Trim function before writing the output to the excel.
Check the generated file Manually before upload it in the application, print the first header alone by reading it as excel. Check whether it is excel generation error, or during upload it occurs?
HI @sarathi125 actually i want to generate as CSV is there any option to ignore first row and start writing from second row i think only in excel it is possible.
yes we can ignore the first row. To do this you can read the excel sheet (Read Range) into a data table, from there you can write the data into another excel sheet by ignoring the headers.
@rtallapudi yea i tried this option but i want it as a csv file,the option i could think of is adding the header previously in an excel file then writing data from the query and recording the file–>save as–>.csv option…any other way is there??
If you would like to rename the column header then you can use an Assign activity:
Assign dt1.Columns(0).ColumnName = "abc"
If you want to rename the first cell then you can like this:
Assign dt1.Rows(0).Item(0) = "abc"
If you want to skip first row, then you can use this in the Write CSV:
dt1.AsEnumerable.Skip(1).CopyToDataTable
Or you could possible just ignore Headers with unchecking Add Headers.
You can also use a string (because CSV files are text-based comma-delimited)
Output Data Table to strData
String.Join(System.Environment.Newline,strData.Split({System.Environment.Newline},System.StringSplitOptions.None).Skip(1))
Write Text File with .CSV extension
Just some ideas I’m throwing out there, and I apologize if I make any mistakes.
Hi @ClaytonM if i use dt1.AsEnumerable.Skip(1).CopyToDataTable the first row is not getting skipped ,any option to just ignore the header and write from row 2?