I need to make a tab delimited text file from a spreadsheet:
https://s3.amazonaws.com/seller-templates/ff/na/us/Flat.File.Listingloader.xls
You will see that there are two headers:
I am using the C# FileHelper library. I decided to create the headers manually:
var engine = new FileHelperEngine<FlatFileListingsData>();
var orders = new List<FlatFileListingsData>();
orders.Add(new FlatFileListingsData() { ConditionType = "New", ConditionNote = "New", Price = 9, ProductId = "B009Q76ODU", ProductIdType = "ASIN", Quantity = 1, Sku = "Test1" });
string rowHeaders = "sku" + "\t" + "price" + "\t" + "quantity" + "\t" + "product-id" + "\t" + "product-id-type" + "\t" + "condition-type" + "\t" + "condition-note" + "\t" + "ASIN-hint" + "\t" + "title" + "\t" + "product-tax-code" + "\t" + "operation-type" + "\t" + "sale-price" + "\t" + "sale-start-date" + "\t" + "sale-end-date" + "\t" + "leadtime-to-ship" + "\t" + "launch-date" + "\t" + "is-giftwrap-available" + "\t" + "is-gift-message-available" + "\t" + "fulfillment-center-id" + "\t" + "main-offer-image" + "\t" + "offer-image1" + "\t" + "offer-image2" + "\t" + "offer-image3" + "\t" + "offer-image4" + "\t" + "offer-image5";
engine.HeaderText = "TemplateType=Offer" + "\t" + "Version=2014.0703" + Environment.NewLine + rowHeaders + Environment.NewLine + rowHeaders;
engine.WriteFile("output2.txt", orders);
[DelimitedRecord("\t")]
public class FlatFileListingsData
{
public string Sku { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
public string ProductId { get; set; }
public string ProductIdType { get; set; }
public string ConditionType { get; set; }
public string ConditionNote { get; set; }
}
Is this an accurate representation of the xls file that I have shown? Interestingly enough, I try upload this text file to Amazon. I receive an error about the TemplateType=Offer row being missing:
The file's header row is missing or invalid. The header row is for Amazon use only and must not be modified or deleted. To correct this error, download the template again from seller Help and use that new copy, or insert the correct header row directly above the column headings in your existing file.