HTTP Request Attachment as CSV File is Over Writing with Header and Parameter details which i have mentioned in Collections

Hi Team, Good Day!
I am creating a Service Request in Service now Via API and i got the Response.

from that response i will get the required information which is used to hit Attachment file API to the Created SR only.

Here to Create SR in first API and File Attachment to the Same Created SR is Second API.

after hit the second API with CSV file and File name. the file is attaching to the created Service Request but when i downloaded the file and verified the file is look like the attachment.

Actual out put i am getting :

Expected output:
image

i know that i am missing something to Add a header so kindly help me to get it resolved.

Hello @saikumar.kuncha
You can use Regex to get the Expected Output
Trty this

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=)[A-Za-z0-9\n\t\D\d]+").tostring

or

System.Text.RegularExpressions.Regex.Match(YourString,"(?=Cust)[A-Za-z0-9\n\t\D\d]+").Tostring

Thank you so much for the Quick response @Gokul_Jayakumar.

But, Actually my work is finished after Attaching the File to the SR .
So the file needs to be uploaded to the SR as it is presented.

But When i am attaching the File the file is uploaded to SR with an updated Unwanted data
like :

After attached file downloaded the presented file data is: I don’t need this

From Hear to (

-----------7A3119B7-9FA5-4B72-9E55-F236E1C0E2FE
Content-Disposition: form-data; name=“table_name”

sc_request
-----------7A3119B7-9FA5-4B72-9E55-F236E1C0E2FE
Content-Disposition: form-data; name=“table_sys_id”

e0a18838878a655059590f650cbb3585
-----------7A3119B7-9FA5-4B72-9E55-F236E1C0E2FE
Content-Disposition: form-data; name=“file_name”

UPT_DATA_AUTOMATION_Q_03-04-2023.csv
-----------7A3119B7-9FA5-4B72-9E55-F236E1C0E2FE
Content-Disposition: form-data; name=“file”; filename=“UPT_DATA_AUTOMATION_Q_03-04-2023.csv”
Content-Type: application/octet-stream

 Hear ) Cust Ctry,Product ID,Customer L4,LOCID
PL,91300592,0090057181,2621
PL,91300462,0090065612,2621

If you identify the Data which is in the CSV file after downloading it from SR request. it contains the additional data.

the actual file data is : I need to upload the data like this and when i download it from SR the file should only contains this actual information

Cust Ctry,Product ID,Customer L4,LOCID
PL,91300592,0090057181,2621
PL,91300462,0090065612,2621
PL,91305974,0090556183,2621
PL,91305931,0090059624,2621

while uploading the File the Headers or the Parameters are over writing the CSV file which i am attaching to the SR.

Appending the beginning the file

Appending the After the file

@saikumar.kuncha
Kindly refer to this xaml file, you may get some idea.
Forum_Text_Remove_CSVconvert.zip (150.7 KB)

Thanks for the Solution @Gokul_Jayakumar
but here when i upload attachment it should only upload the file content not with Header details or Parameter details.

@saikumar.kuncha
Try to Uncheck the With headers option in the Write CSV activity.

Did you ever figure this out? I’m experiencing the same issue.