export-to-csv

How can Defining fields delimiter character, Encoding and Records seperator ({CR}{LF}) for CSV files in export (Save As) from Excel by VBA

大城市里の小女人 提交于 2019-12-13 02:58:23
问题 I tied Save As my sheet in CSV format with (Comma Delimited) "," for fields and {CR}{LF} for records in line by below code. The issue is: 1) Generated file is delimited by ";" sign instead of ",". 2) Be sure records are separated by {CR}{LF} 3) How can define encoding as Unicode UTF-8 (in situation if needed) I want this file have save by .txt extension. How can I generate CSV file in true format by above situation? Sub GenCSV() Dim NewBook As Workbook Set NewBook = Workbooks.Add ThisWorkbook

How to read some csv files in a folder in python

社会主义新天地 提交于 2019-12-13 02:39:33
问题 There are 40 csv files; file1.csv, file2.csv. ..., file40.csv in a folder called pathImage. I want to read them, and put them in another csv file sequentially that we called 'output.csv'. The following code does not work for me. im_list=[] for i in pathImage: f= open(i, 'rb') reader = csv.reader(f, delimiter=',') header = reader.next() zipped = zip(*reader) for j in zipped[0]: #zipped[0] is the name of images im_r=misc.imread("%s.png" %j) im_list.append(im_r) I already read the previous

Save a list in python

安稳与你 提交于 2019-12-13 00:56:58
问题 I am trying to export my output to a list. Here is my code: import csv import numpy as np row_list = np.arange(0,5) for row in row_list: a = row + 3 b = row + 4 c = row + 5 result = [a, b, c] csvfile = "/home/Desktop/test" with open(csvfile, "w") as output: writer = csv.writer(output, lineterminator='\t') for val in result: writer.writerow([val]) I run the code, a test file is created on my desktop (which is exactly what I want) but the data in the file is wrong. The output is: 7 8 9 But this

Export different language content in .csv file in c#

荒凉一梦 提交于 2019-12-13 00:25:47
问题 I am trying to export data in a .csv file. Here, the data is in different languages (arabic, danish,.. etc).. the file can be exported successfully but the data content in the file are being replaced by ? and other symbols. i need to export the data as it is, in the .csv file. i tried with every possible way i found out on web but couldn't export the correct data. Can you please help me out. Thanks below is my code. protected void lnkExport_Click(object sender, EventArgs e) { List<Entities

Export Dataframe to Excel Table

北慕城南 提交于 2019-12-12 22:54:53
问题 The simple code down below prints certain elements and their attributes in a dataframe. It iterates through an XML files, looks for these elements and just prints them out Code import xml.etree.ElementTree as ET import pandas as pd tree = ET.parse('1last.xml') root = tree.getroot() for neighbor in root.iter('Description'): print(neighbor.attrib, neighbor.text) for neighbor in root.iter('SetData'): print(neighbor.attrib) for neighbor in root.iter('FileX'): print(neighbor.attrib) for neighbor

Javascript Save CSV file in IE 8/IE 9 without using window.open()

感情迁移 提交于 2019-12-12 20:18:40
问题 I need to download a csv file using javascript in IE 8 and IE9.I tried using window.open(). Here is my code: var URI = 'data:text/csv;charset=utf-8,'; var fileName = "text.csv"; var testlink = window.open("about:blank", "_blank"); testlink.document.write(fileData); //fileData has contents for the file testlink.document.close(); testlink.document.execCommand('SaveAs', false, fileName); testlink.close(); This opens a new window and prompts to save the file.After saving the file,it returns back

Check for number of columns in each row of CSV

戏子无情 提交于 2019-12-12 19:17:08
问题 I have the following Python code: import os import csv import sys g = open('Consolidated.csv', "wb") for root, dirs, files in os.walk('D:\\XXX\\YYY\\S1'): for filename in files: pathname = os.path.join(root, filename) symbol = filename.rpartition('_')[-1].rpartition('.')[0] reader = csv.reader(open(pathname, 'rU')) writer = csv.writer(g, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL) for row in reader: row.insert(0, symbol.upper()) if len(row[2]) == 3: row[2] = '0'+row[2] writer

Exporting CSV response laravel 5.5 and download as csv file

≡放荡痞女 提交于 2019-12-12 19:01:18
问题 I am trying to export and download some data in a csv file using an ajax request. I was able to output the data in a json response to test but could not get it to download in a data.csv file Following is the code I have written so far public function download(Request $request) { if(!empty($request->input('my_checkbox'))) { $studentIdToExportArray = $request->input('my_checkbox'); //$msg = is_array($studentIdToExportArray);//returns true $selectedStudents = []; foreach($studentIdToExportArray

How to export spreadsheet to CSV without evaluating formulas

北城余情 提交于 2019-12-12 18:17:50
问题 I'm looking for a way to export a spreadsheet (from MS Excel or LibreOffice Calc) without evaluating formulas so the formulas are stored in the CSV. I know, for example, I could convert formulas to text in MS Excel prior to export, but don't want to modify the formulas. It appears the default behavior for CSV export in MS Excel loses the formulas if they're not displayed as text. 回答1: First, select the tab with the formulas, then hold "Ctrl" + "~" (the tilde character), then do a File, Save

Creating an xls or csv file from a Javascript variable

萝らか妹 提交于 2019-12-12 14:55:09
问题 I have an app that uses Javascript to perform some calculations and then plot the data, but I'd like to add the option for the user to be able to actually download the data into a csv or xls file. Is there a way in Javascript (or some other method) to have the user press a button, then it will prompt them for the name of the file to save it as, and it will then create a comma-delimited or excel spreadsheet? Thanks! EDIT: Thanks for all the suggestions everyone. Wish I could mark you all as