export-to-csv

python scrapy - output csv file empty

浪尽此生 提交于 2019-12-07 08:54:02
问题 My main Spider code: from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from Belray_oil.items import BelrayOilItem class BelraySpider(BaseSpider): name = "Belray_oil" allowed_domains = ["mxdirtrider.com/"] start_urls = ["http://www.mxdirtrider.com/h-products/bel-ray/2011-02/pr-bel-ray-accessories-lubricant-oil-2-stroke-2t-mineral-engine.htm?ref=search"] def parse(self, response): hxs = HtmlXPathSelector(response) name = hxs.select("//div[@id='product-title']/h1

Writing csv file in asp.net

梦想与她 提交于 2019-12-07 03:58:43
问题 I'm trying to export data to a csv file, as there are chinese characters in the data i had to use unicode.. but after adding the preamble for unicode, the commas are not recognized as delimiters and all data are now written to the first column. I'm not sure what is wrong. Below is my code which i wrote in a .ashx file. DataView priceQuery = (DataView)context.Session["priceQuery"]; String fundName = priceQuery.Table.Rows[0][0].ToString().Trim().Replace(' ', '_'); context.Response.Clear();

Export MySQL to CSV, some columns with quotes and some without

半世苍凉 提交于 2019-12-07 03:27:07
问题 I am exporting a MySQL table and I want to export the integer type columns without double quotes but the varchar type columns with double quotes. I need to do this to have the correct formatting for the next step in my work. Can this be done in MySQL? I know I could probably do this in a python script but the csv files are pretty large (>1 GB) so I think it might take awhile to do that. Anyway, is this possible using MySQL Queries? Here's my current export script format: SELECT 'column_name_1

Angular ui-grid external export buttons

佐手、 提交于 2019-12-07 01:40:48
问题 I am new working with the Angular UI-GRID and I need to create external buttons for the exporting features like PDF export and CSV Export similar to this image. Do you have any idea how can I do it ? Also I need a Print button but I don't see it in the documentation. Is there a Print behavior for this grid ? Thank you, Ernesto 回答1: Taking a look at the ui-grid.exporter source code (this will specifically address pdf export, which starts at ~line 972, but you can apply it to the csv use case

Exporting data from database in php,and the file format for excel export should be as windows 97-2003 workbook

こ雲淡風輕ζ 提交于 2019-12-07 01:31:26
Below is my code to export data from mysql database. It works properly, but while exporting excel file, file saved as in tab delimeter format. I just need to save it in windows 97-2003 workbook. I keep changing on header's, but it doesn't work.. while open those file it popups some alert such as "the file you are trying to open,'filename.xls', is in different format than specified by the file extension.." I need to rid on it. Can any one give suggestion.. thanks in advance :) HTML coding: <input type="submit" name="frmDownload" id="frmDownload" value="CSV" title="Export" class=

Python/Numpy - Save Array with Column AND Row Titles

无人久伴 提交于 2019-12-06 23:49:09
问题 I want to save a 2D array to a CSV file with row and column "header" information (like a table). I know that I could use the header argument to numpy.savetxt to save the column names, but is there any easy way to also include some other array (or list) as the first column of data (like row titles)? Below is an example of how I currently do it. Is there a better way to include those row titles, perhaps some trick with savetxt I'm unaware of? import csv import numpy as np data = np.arange(12)

How to save Amazon Redshift output to local CSV through PSQL on SQL WorkBench?

拜拜、爱过 提交于 2019-12-06 22:38:46
问题 I am writing psql through Amazon Redshift and now I am trying to save the output as CSV through PSQL query, on SQL WorkBench The reason I am planning to do this through query instead of using select clause and then right click to save the output as csv, is because there are large amount of data, I found that if I generate the output into a temp table, it's much much faster than using select to display all the output. Therefore, I am thinking whether saving to local CSV can be faster too. I

Creating a CSV file from MySQL table using php

人盡茶涼 提交于 2019-12-06 17:18:00
问题 this code creates a csv file. However, I have avoided printing out commas in the fields because it is used as a delimeter (see line 22). Now I want to remove (carriage returns and new lines) from the fields. Adding $somecontent .= str_replace("\n", "", $val); on line 23 does not seem to work. any ideas? @chmod($export_csv, 0777); $fe = @fopen($export_csv."/export.csv", "w+"); if($fe){ $somecontent = ""; $fields_count = 0; // print field headers $db->query($sql_view); if($row = $db->fetchAssoc

The best way to export openerp data to csv file using python [closed]

梦想的初衷 提交于 2019-12-06 15:39:40
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . Which is the best to way to export openerp data to csv/xls file using python so that i can schedule it in openerp( i cant use the client side exporting)? using csv python package using xlwt python package or any

DJANGO: How to Output CSV with model containing many-to-many field?

梦想的初衷 提交于 2019-12-06 14:58:50
I have an "Export to CSV" button that exports all car models. When I export all cars into CSV, the "features" (e.g. AM/FM Radio, Moon Roof, Leather Interior, Bluetooth, GPS etc..) column displays as the following: [<Feature: GPS>, <Feature: Leather>] How do I get rid of all that other stuff, and just have "GPS, Leather"? MODEL class Features(models.Model): name = models.CharField(max_length=20) def __unicode__(self): return self.name class Car(models.Model): model_name = models.CharField(max_length=20) features = models.ManyToManyField(features) def __unicode__(self): return self.model_name