I'm using Google Adwords CSV export feature to parse some reports and format them the way I want. The problem is, however, that i can't find any CSV parser that is able to handle my adwords reports.
The biggest issue is that column headers is not placed at the first row, but the sixth.
Does anyone know a good CSV reader that is able to parse adwords reports?
And yes, i'm aware of the API but that's something i can't use, unfortunately. Nor am i able to export by xml, as it's lacking some information.
Edit: CSV file sample:
RAPPORT:, MyReportname
KONTO:,MyAccountName
DATUMINTERVALL:,1 Jan 2010 - 1 Feb 2010
KAMPANJER:,Alla
SÖKORD:,Alla
ADWORDS-TYP:,Alla
Kampanj,Annonsgrupp,Sökord,Matchning av sökord,Sökordsstatus,Uppskattat förstasidesbud,Kvalitetsresultat,Aktuell högsta CPC,Sökordets destinationsadress,Visningar,Klick,CTR,Gen. CPC,Kostnad,Medelposition
MyCampaignName,MyCampaignGroup,MyKeyword,Exakt,Aktiv,"0,67",7,"9,00",standard URL,20,3,"15,00%","6,38","42,13","1,4"
MyCampaignName,MyCampaignGroup,MyKeyword,Exakt,Aktiv,"0,12",3,"12,00",standard URL,20,3,"22,00%","9,21","1,13","1,5"
MyCampaignName,MyCampaignGroup,MyKeyword,Exakt,Aktiv,"0,24",1,"0,00",standard URL,20,3,"37,00%","21,42","9,13","1,6"
MyCampaignName,MyCampaignGroup,MyKeyword,Exakt,Aktiv,"0,09",6,"7,00",standard URL,20,3,"98,00%","11,21","17,13","1,8"
Slutsummor och sammantagna genomsnitt:,,,,,,,,,807,100,"12,39%","5,87","587,21","2,1"
Edit 2:
开发者_如何转开发As i wrote in a comment:
I tried using FileHelpers 2.0, but, as I understand, i need to create a POCO to map properties to CSV-values. The problem is that i dont know what properties will existing. Do you have any solution to this? I could use FileHelpers RunTime Records and create a class dynamically, but i feel that's overkill. There must be something i'm missing here.
Thanks in advance
Have a look at FileHelpers 2.0 - it's very flexible, very powerful, and it allows you to e.g. define how many lines in a file to skip before the actual data rows begin. I think you should be able to handle your Google Adwords CSV file with FileHelpers.
If you can get your system working assuming the 1st row is the header, then try parsing the file and removing the first few lines, then either passing the remainder of the string, or writing out the rest of the file to a temporary file.
精彩评论