i have already saved a recent import in data tasks and now i am trying to call it automatically:
DoCmd.TransferText acImportDelim, "import1", "temp", "C:\Documents and Settings\agordon\Desktop\ACTIVITYEX.csv"
the error that i am getting is:
the text file specification "import1" does not exist
does anyone know what this error means?
It's expecting the parameter "Import1" to be a specification name.
If "import1" is not an actual file, then you can just leave this parameter empty and the file should import into table temp (assuming temp is has the same number of fields as your CSV)
Related
I'm importing a .TSV file, with the first row being the variable name and the first column as IDs, into SPSS using a syntax but I keep getting a Failure opening file error in my output. This is my code so far:
GET DATA
/TYPE=TXT
/FILE=\filelocation\filename.tsv
/DELCASE=LINE
/DELIMTERS="/t"
/QUALIFIER=''
/ARRANGEMENT=DELIMITED
/FIRSTCASE=2
/IMPORTCASE=ALL
/VARIABLES=
/MAP
RESTORE.
CACHE.
EXECUTE.
SAVE OUTFILE = "newfile.sav"
I think I'm having an issue in the delimters or qualifiers subcommand. Wondering if I should also include the variables under the variables subcommand. Any advice would be helpful. Thanks!
The GET DATA command you cite above has an empty /VARIABLES= subcommand.
If you used the "File -> Import Data -> Text Data' wizard, it would have populated this subcommand for you. If you are writing the GET DATA command syntax yourself, then you'd have to supply that list of field names yourself.
I have a question in connection with this problem. I try to import csv file into mysql table but I get this error message: "can't analyze file. "please try to change the encoding type. If that doesn't help, maybe the file is not: csv or the file is empty". I set the coding to utf 8 in excel when I saved the csv file but doesn't work.
Thanks your help guys :)
These are the first three rows of the csv:
How to convert a DBF to CSV?
I need, use this library but it gave error: http://pythonhosted.org/dbf
import dbf
dbf.export('crop1-fx')
print 'Done'
"C:\Users\User\Anaconda2\python.exe"
"C:/Users/User/Desktop/Python/23/dbf/insertValuesDBF.py" Traceback
(most recent call last): File
"C:/Users/User/Desktop/Python/23/dbf/insertValuesDBF.py", line 3, in
dbf.export('crop1-fx') File "C:\Users\User\Anaconda2\lib\site-packages\dbf\ver_2.py", line 7824,
in export
table = source_table(table_or_records[0]) File "C:\Users\User\Anaconda2\lib\site-packages\dbf\ver_2.py", line 7956,
in source_table
table = thingie._meta.table() AttributeError: 'str' object has no attribute '_meta'
Process finished with exit code 1
You almost had it:
import dbf
db = dbf.Table('crop1-fx')
dbf.export(db)
The above will create a crop1-fx.csv file; however, I'm not sure this will work with a 24-digit numeric field in the table.
To convert a .DBF file to .CSV, download dBASE III PLUS or any other dBASE
software available on NET. Please note I am referring to 16 bit platform on
DOS.
Once dBASE is downloaded, go to the DOT prompt and give the following commands:
Type
use <the dbf file in question without the extension .dbf>
You will see the name of the dbf file on the display bar
Then, type "copy to" <file name you want, limited to 8 characters>
"delimited"
Now the data in the dbf file is sent to a TEXT file with data in each field surrounded by " " (double inverted commas) and separated by , (comma)
Now this file can be used to export the data to any other DATABASE SYSTEM which has got provision to convert this .CSV or DELIMITED FILE to the new database.
If only comma-separated file without the " " marks are required a procedure
can be written in dBASE to achieve that also.
Is it possible to check if a csv file has any data in it from VBA??
I want to import CSV file to access. It works fine if there is data in the CSV file but error occurs when there is no data in the CSV file.
You can use the FileLen function:
If FileLen("C:\your_dir\file_to_read.csv") = 0 Then MsgBox "Csv file is empty"
I have a tab-delimited text file and want to import it in MS Access using VBA code.
I have created an MS Access form and have used the DoCmd.TransferText method:
DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)
It works well for CSV File. I'm not sure how to do it in case of tab-delimited text files.
Any suggestions?
Do a manual import, changing the delimiter to TAB, save the import spec, and then specify that import spec in your TransferText command.