Perl Script to import CSV file to Import Set table results in error "Attachment could not be successfully extracted."Issue Perl Script to import CSV file to Import Set table results in error "Attachment could not be successfully extracted."CauseThe perl script code is not implemented correctly, also make sure to set the content type as below Content_Type => 'form-data' .ResolutionUse below sample perl script code to upload a CSV from a mid server. 1. Create a file MM_uploadafile2.pl ------------------ # file: MM_uploadafile2.pl use strict;use LWP::UserAgent;use HTTP::Request::Common;use Getopt::Long;use File::Basename;my ( $o_url, $o_fqn );GetOptions("url=s" => \$o_url,"uploadfile=s" => \$o_fqn,);# mandatory arguments: url&usage unless ( $o_url && $o_fqn );my $url = $o_url;my $fname = $o_fqn;# put timeouts, proxy etc into the useragent if neededmy $ua = LWP::UserAgent->new();# setup basic authentication credentials$ua->credentials('fifththirddev.service-now.com:443','Service-now','tufinapi.integration.user' => 'tufinapi2021');my $req = POST $url, Content_Type => 'form-data',Content => [submit => 1,upfile => [ $fname ]];my $response = $ua->request($req);if ($response->is_success()) {print "OK: ", $response->content;} else {print $response->as_string;}exit;sub usage {printf "usage: %s --url=%s --uploadfile=%s\\n",basename($0),'https://....','c:/data/test.csv';exit}------------------ 2. Execute the perl script like below from command prompt. - perl MM_uploadafile2.pl --url="https://<instance>.service-now.com/sys_import.do?sysparm_import_set_tablename=<import_set_table>&sysparm_transform_after_load=true" --uploadfile=D://ServiceNow/MIDSERVER/agent/Import/APItoCSVOutput.csv 3. Parameter "sysparm_transform_after_load=true" in above script instruct the import set to transform immediately after loading. 4. Parameter uploadfile in above script indicate the location of the CSV file to upload.Related LinksPosting a CSV file - Perl and Java examples