English 中文(简体)
Google Adwords CSV File Parser
原标题:

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.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签