export-to-csv

Error on Dynamic csv file export using plpgsql copy to csv in a function

拈花ヽ惹草 提交于 2020-02-07 03:41:44
问题 I am trying to filter a postgresql table for rows that have a product id as a foreign key. For each product id, I need to export 1 csv each to a folder eg , prod1.csv, prod2.csv etc. I have tried to create the function below to automate this but the function is failing when I run it. Can anyone kindly assist me to fix the function or recommend a better approach? CREATE or replace FUNCTION exportdata() RETURNS SETOF record AS $$ DECLARE rec text; BEGIN FOR rec IN ( Select distinct t.products

How to export more than 1 million rows from SQL Server table to CSV in C# web app?

戏子无情 提交于 2020-02-06 03:38:39
问题 I am trying to export a SQL Server table with 1 million rows and 45 columns to a .csv file for the user to download via the web interface but it takes so long that I eventually have to stop the process manually. I use a SqlDataReader and write into the file as the reader reads to avoid memory problems. The code works for small tables (less than 3k rows) but the large one keeps running and the destination file stays at 0 KB. using (spContentConn) { using (var sdr = sqlcmd.ExecuteReader())

How to export and save tables to .csv from access database in java

点点圈 提交于 2020-02-03 02:10:56
问题 I am trying to export a lot of large tables from a MS Access db with java using the jdbc:odbc bridge. I wanted to save these tables to a CSV file first was wondering what would the best way to do this would be? any help would be appreciated. 回答1: Fetch the values and write a standard text file line by line separating the values. I#m sure there are some libs for this purpose try { FileWriter writer = new FileWriter("c:\\temp\\MyFile.csv"); while(result.next()) { for(int i = 0; i < columnSize;

Getting an Extra Empty line when exporting Excel Range to .txt file

删除回忆录丶 提交于 2020-01-30 07:42:08
问题 I am trying to copy an Excel range to a .txt file. The export is successful, with one exception, It adds one " extra " empty line at the end. I've read and tests many of the solution on SO (and other sites), but still without any success. My Code (relevant part) ' === Export to the .txt file === Dim TxtFileName As String, lineText As String TxtFileName = ThisWorkbook.Path & "\Inv_" & Format(Date, "yyyymmdd") & ".txt" Open TxtFileName For Output As #1 With StockSht For i = 1 To LastRow For j =

How to export to csv file a PHP Array with a button?

和自甴很熟 提交于 2020-01-25 08:59:09
问题 I have 3 charts on my page, they are made from 3 php arrays. I would like to print this arrays's data by clicking a button below each chart. I could do all the queries again in the file wich will print the csv file, but I guess it would be unnecesary such repeated code this way. I tried putting the arrays data on hidden inputs, converting them with json_encode first, and then in JS by clicking these buttons will get it and send it through ajax to the file wich will convert it again to a PHP

How to parse a json list of dictionaries to csv

怎甘沉沦 提交于 2020-01-24 23:26:30
问题 I have a json object retrieved from the google places api. The object is a dictionary with three keys {'status', 'html_attributions', 'results'}. The key results contain a list of dictionaries with the information that I need which is the latitude, longitude inside the 'geography' dict. I need to parse the lat longitude to a csv file for later processing. So far this is the code that I have: response = urllib2.urlopen(url) result = response.read() d = simplejson.loads(result) g=d['results'] y

jackson-dataformat-csv: cannot serialize LocalDate

橙三吉。 提交于 2020-01-24 14:34:30
问题 When I try to serialize object containing Local date, I get following error: csv generator does not support object values for properties I have JSR-310 module enabled, with WRITE_DATES_AS_TIMESTAMPS and I can convert the same object to JSON without problem. For now I resorted to mapping the object to another, string only object, but it's decadent and wasteful. Is there a way for Jackson csv mapper to acknowledge localDates? Should I somehow enable JSR-310 specifically for csv mapper? 回答1: I

how to get a list of all user friends?

点点圈 提交于 2020-01-24 08:14:03
问题 I am building an app using Facebook Graph API v.20 . The first thing it needs to do is to export the complete list of friends from the user ( ID, name and picture ) to a CSV file. Is this possible? 回答1: Short answer: No. The Graph API v2.0 reference documentation implies that your app will only be able to access (through the API, at least) those of the user's friends who have themselves used your app and allowed your app to access their own friends list: Permissions A user access token with

how to get a list of all user friends?

爷,独闯天下 提交于 2020-01-24 08:13:08
问题 I am building an app using Facebook Graph API v.20 . The first thing it needs to do is to export the complete list of friends from the user ( ID, name and picture ) to a CSV file. Is this possible? 回答1: Short answer: No. The Graph API v2.0 reference documentation implies that your app will only be able to access (through the API, at least) those of the user's friends who have themselves used your app and allowed your app to access their own friends list: Permissions A user access token with

Count Rows in CSV files and export results to CSV

こ雲淡風輕ζ 提交于 2020-01-22 03:22:13
问题 I am trying count the rows containing values in a bunch of CSV in a folder. I managed to get the code to count it but I can't seem to find a way to export the results to a CSV. All I got is a blank CSV. What am I missing here? $FOLDER_ROOT = "C:\Test\2019" $OUTPUT_CSV = "C:\Test\2019\Count.csv" Get-ChildItem $FOLDER_ROOT -re -in "*.csv" | ForEach-Object { $filestats = Get-Content $_.Fullname | Measure-Object -Line $linesInFile = $filestats.Lines - 1 Write-Host "$_,$linesInFile" } | Export-Csv