export-to-csv

Cannot export data to a file in R (write.csv)

纵然是瞬间 提交于 2019-12-04 22:51:53
I am trying to export data in R to a csv file, and as much simple as I try to do it, I always get the same error message. Example: I create a simple data vector to export x <- c(1,3,4,3,5,7,5,8,2,5,7) I try to export with: write.csv(x,file='whatever.csv') And I get an error: error in file(file ifelse (append a w )) cannot open the connection In addition: Warning message: In file(file, ifelse(append, "a", "w")) : cannot open file 'whatever.csv': Permission denied How can I solve this? Soid First part is to check the working directory and ensure that you have write access to that directory. You

Creating a CSV file from MySQL table using php

走远了吗. 提交于 2019-12-04 22:24:18
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()){ foreach($row as $key => $val){ if($fields_count++ > 0) $somecontent .= ","; $somecontent .=

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

删除回忆录丶 提交于 2019-12-04 21:38:46
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 other package? And also how can I dynamically provide the path and name to save this newly created csv file ifixthat Well their are certain ways like using csv python package In this case you can take advantage of the export_data service which will automatically produce csv for you, you can use with Scheduler(cron job ) or even you can write script for it. using xlwt python package

How to format output when exporting SQL query to CSV

北城以北 提交于 2019-12-04 18:57:05
I have a task to save the results of a SQL Server query into a .csv file. After some googling I decided to use PowerShell. I found a script, modified it a bit, it works and almost all is ok. $server = "server" $database = "database" $query = "SELECT * from et_thanks" $tod = Get-Date; $file = "{0:yyyyMMdd}_go.csv" -f $tod; $extractFile = @" \\info\export_files\$file "@ $connectionTemplate = "Data Source={0};Integrated Security=SSPI;Initial Catalog={1};" $connectionString = [string]::Format($connectionTemplate, $server, $database) $connection = New-Object System.Data.SqlClient.SqlConnection

Insert column to a CSV file in Perl using Text::CSV_XS module

为君一笑 提交于 2019-12-04 18:06:12
How can I add column to a CSV file using the Text::CSV_XS module? The print routine in the module only writes the array as a row. If I have an array, how can I write it to the file as a column? I already wrote the code below open my $outFH, ">", $outFile or die "$outFile: $!"; $outFilecsv = Text::CSV_XS->new ({ binary => 1, eol => $/ }); @column = read_column($inFile, $i); $outFilecsv->print($outFH, \@column)or $outFilecsv->error_diag; where read_column method reads returns a specified column from another csv file. To add a column, simply add a single element to each row and print the rows as

Jasper Reports OutOfMemoryError on export

落爺英雄遲暮 提交于 2019-12-04 14:08:42
问题 I have written a web app for managing and running Jasper reports. Lately I've been working with some reports that generate extremely large (1500+ page) outputs, and attempting to resolve the resultant memory issues. I have discovered the JRFileVirtualizer, which has allowed me to run the report successfully with a very limited memory footprint. However, one of the features of my application is that it stores output files from previously run reports, and allows them to be exported to various

linux awk comparing two csv files and creating a new file with a flag

﹥>﹥吖頭↗ 提交于 2019-12-04 13:30:45
I have 2 CSV files that i need to compare and get the difference to a newly formatted file. The samples are given below. OLD file DTL,11111111,1111111111111111,11111111111,Y,N,xx,xx DTL,22222222,2222222222222222,22222222222,Y,Y,cc,cc DTL,33333333,3333333333333333,33333333333,Y,Y,dd,dd DTL,44444444,4444444444444444,44444444444,Y,Y,ss,ss DTL,55555555,5555555555555555,55555555555,Y,Y,qq,qq NEW file DTL,11111111,1111111111111111,11111111111,Y,Y,xx,xx DTL,22222222,2222222222222222,22222222222,Y,N,cc,cc DTL,44444444,4444444444444444,44444444444,Y,Y,ss,ss DTL,55555555,5555555555555555,55555555555,Y,Y

How to use responses from a Jmeter JDBC Request in a HTTP Request

半腔热情 提交于 2019-12-04 12:16:29
Here's my situation: I want to do this: I have a list of URLs in a MySQL database which I want to hit using a HTTP Request to see if the response is a HTTP Status code of 404 or not. I have done this: Added and configured a JDBC Config Element. Added and configured a JDBC Request Sampler. Basically a select statement that returns a table with 8 columns. I have provided 8 comma-separated variables for the 'Variable names' field, so that the results of the JDBC request can be identified with these variable names. Created a HTTP Request Sampler that uses one of those variables ${url} in the

Export MySQL data to .csv using PHP

纵饮孤独 提交于 2019-12-04 12:10:20
I'm exporting data to a .csv file and it's working perfectly but I have one small issue. I fetch name and gender from a table but for gender I save id in my database (i.e., 1 = Male , 2 = Female ). My below code gives me id for gender, how can I fix it? Return 1 for Male and 2 for Female: $rows = mysql_query("SELECT `name`, `gender` FROM TABLE"); while ($row = mysql_fetch_assoc($rows)) { fputcsv($output, $row); } Try this : $rows = mysql_query("SELECT `name`, `gender` FROM TABLE"); while ($row = mysql_fetch_assoc($rows)) { if($row['gender'] == 1) { $row['gender'] = 'Male'; } else { $row[

R: Export and import a list to .txt file

亡梦爱人 提交于 2019-12-04 09:39:59
This post suggests a way to write a list to a file. lapply(mylist, write, "test.txt", append=TRUE, ncolumns=1000) The issue with this technic is that part of the information of the list (the structure into subparts and the names of the subparts) disappear and it is therefore very complicated (or impossible if we lost the extra information) to recreate the original list from the file. What is the best solution to export and import (without causing any modification, including the names) a list? You can save your list using these commands (given that there are no element names containing a dot)