Google Adwords CSV 文件解析器

发布于 2024-08-21 22:34:30 字数 1422 浏览 8 评论 0原文

我正在使用 Google Adwords CSV 导出功能来解析一些报告并按照我想要的方式设置它们的格式。但问题是,我找不到任何能够处理我的 adwords 报告的 CSV 解析器。

最大的问题是列标题不是放在第一行,而是放在第六行。

有谁知道一个能够解析 AdWords 报告的优秀 CSV 阅读器?

是的,我知道 API,但不幸的是我无法使用它。我也无法通过 xml 导出,因为它缺少一些信息。

编辑:CSV 文件示例:

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"

编辑 2:

正如我在评论中所写:

我尝试使用 FileHelpers 2.0,但是,作为 我明白了,我需要创建一个 POCO 将属性映射到 CSV 值。这 问题是我不知道什么 属性将存在。你有 有什么解决办法吗?我可以用 FileHelpers RunTime 记录并创建 一个动态的类,但我觉得那是 矫枉过正。一定有什么我是 这里不见了。

提前致谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉城已无爱 2024-08-28 22:34:30

看看FileHelpers 2.0 - 它非常灵活,非常强大,并且它允许您定义例如多少行在实际数据行开始之前要跳过的文件中。我认为您应该能够使用 FileHelpers 处理您的 Google Adwords CSV 文件。

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.

深居我梦 2024-08-28 22:34:30

如果假设第一行是标题,您可以让系统正常工作,则尝试解析文件并删除前几行,然后传递字符串的其余部分,或将文件的其余部分写到临时文件中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文