Is it possible to set the filename of a excel to a name from database upon downloading ?
Your question is not precise, but I guess, probably you want to set the name of an Excell's file possible to download from your page to the name saved in the database.
In CodeIgniter it's possible to use Download Helper.
First select from the DataBase the name you want to show for users and save it to a variable. For example:
$name.
Load Download Helper:
$this->load->helper('download');
Use function force_download() to serve your Excel file for user with your name from DB:
$data = file_get_contents($excell_file_path); // Read the file's contents
force_download($name, $data);
Related
I have the file location in my database and i would loop on each file location to open the file and extract data in Talend to insert in my database .
I get the file location with a request and i get something like that :
So, i would loop on each row, and put the FILE_PATH result in a component Excel.
How can I do this?
Thank you !
You have to use tFlowToIterate : it will create a loop based on incoming data (filepath here)
tDBInput>tFlowToIterate>tFileInputExcel
In tFileInputExcel, just put the global variable coming from your tFlowToIterate as the filepath.
Your case will be similar to this talend example with tFlowToIterate : https://help.talend.com/r/LffDtDyh9DacekHL_U0CGw/798DoNGV_8WjRj6C42_HJQ
I have qvw file with sql query
Data:
LOAD source, color, date;
select source, color, date
as Mytable;
STORE Data into [..\QV_Data\Data.qvd] (qvd);
Then I export data to excel and save.
I need something to do that automatically instead of me
I need to run query every day and automatically send data to excel but keep old data in excel and append new value.
Can qlikview to do that?
For that you need to create some crazy macro that runs after a reload task in on open-trigger. If you schedule a windows task that execute a bat file with path to qlikview.exe with the filepath as parameters and -r flag for reload(?) you can probably accomplish this... there are a lot of code of similar projects to be found on google.
I suggest adding this to the loadscript instead.
STORE Table into [..\QV_Data\Data.csv] (txt);
and then open that file in excel.
If you need to append data you could concatenate new data onto the previous data.. something like:
Data:
load * from Data.csv;
//add latest data
concatenate(Data)
LOAD source, color, date from ...
STORE Data into [..\QV_Data\Data.csv] (txt);
I assume you have the desktop version so you don't have access to the Qlikview Management Console (if you do, this is obviously the best way).
So, without the Console, you should create a txt file with this command: "C:\Program Files\QlikView\Qv.exe" /r "\\thePathToYourFile\test.qvw". Save this file with .cmd file extension. After that you can schedule this command file with the windows task scheduler.
Currently I am face this issue.
when I am directly opening from IE with out saving , IE adding [1]/Version to file name
Example: Test.xlsx file in backend but when i am opening the file its renamed to Test[1].xlsx.And this is creating the issue.
Can any one suggest what I am doing wrong here.
//res.setContentType("application/vnd.ms-excel");
//res.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
//res.reset();
//res.setHeader("Expires", "0");
myDownloadTask{
//res.setHeader("Cache-Control","must-revalidate,post-check=0, pre-check=0");
//res.setHeader("Pragma", "public");
//res.setContentType("application/force-download");
//res.setHeader("Content-Transfer-Encoding", "binary");
res.setContentType("application/ms-excel; charset=UTF-8");
res.setCharacterEncoding("UTF-8");
fileName=EncodeFileName(fileName);
res.setHeader("Content-Disposition","attachment; filename="+fileName);
}
You have a file with Test.xlsx already on your hard disk, this is why IE rename it to Test[1].xlsx.
I think you can not handle it, you can create a unique file name on the server every time, or gently prompt to user to make sure he does not have a file with same name on his hard disk !
I have a webpart that users can upload files to a document library.
a problem appears if a user uploads a file with a name identical to a file name already exists in the library.
in this case I want the new file to be added as a new version to the existing file using the object model not the web services.
how to achieve that ?
thanks
OK here's the Answer:
//byte array holding the contents of the file
byte[] contents = File.ReadAllBytes(path);
file.CheckOut();
file.SaveBinary(contents);
file.CheckIn("New version");
the trick is in the check in/ check out
thanks
I have a serious issue.
I am using excel object for opening the excel file
it works fine i my PC.
when i make application as a website and running the page and uploading it gives the error "'C:\Documents and Settings\Administrator\Desktop\Work\SABRE MSO Mapping Request Template.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted. ".
I think it taking server path...but i want to open client excel file before saving the file to the server.
Plz help.
have you tried server.mappath() method ?? Do you have proper permissions setup to access the folder??
Are you passing complete file path to the excel for opening the file? Please try this:
if (fileUpload.HasFile)
{
string fileName = "PATH_RELATIVE_TO_YOUR_SITE" + "FILE_NAME";
fileUpload.PostedFile.SaveAs(fileName);
//NOW open excel using fileName;
}
also you need write permissions to the path (folder) you are writing file to.