Read data from excel file inside file cabinet - netsuite

What I want is to read excel file inside netsuite File Cabinet.
On nlapiLoadFile i cant able to read excel file. I used getValue() but result will be in another format.
its show something like dW5kZWZpbm..
How to get data help me out.

finally found the solution..
just to use
var temp = nlapiDecrypt(somestring,'base64');

Related

Exporting panda data frame as excel file on FTP

I am exporting a panda data frame as an excel file on FTP and using the below code. The code is creating a file on FTP. The issue here is that if I am make any change in the code and expecting a different output file it is creating the same output file as before. However if I change the file name in: myFTP.storbinary('STOR %s.xlsx' %filename,bio)..It works fine. Moreover, if I made the output on my local keeping the same name it also works fine. I dont want to change the file name every time I make some change in my code."It is not creating a different file with the same name" Below is the code:
myFTP = ftplib.FTP("ftp address","username","password)
myFTP.cwd("change directory/")
buffer=io.BytesIO()
df.to_excel(buffer,index=False)
text = buffer.getvalue()
bio = io.BytesIO(text)
file name = 'FileName_{0}{1}'.format(current_year,current_month)
myFTP.storbinary('STOR %s.xlsx'%file_name,bio)
myFTP.close()
Name of the output file must be: FileName_currentyearcurrentmonth
file name = 'FileName_{0}{1}'.format(current_year,current_month)
If this line of code is as it is in your code, well. It seens you have a syntax error. Also in cases like this contextual manager are actually pretty usefull. Why dont you try doing like this. So if you get an error well you dont keep your file open
with ftplib.FTP("ftp address","username","password) as myFTP:
myFTP.cwd("change directory/")
buffer=io.BytesIO()
df.to_excel(buffer,index=False)
text = buffer.getvalue()
bio = io.BytesIO(text)
file name = 'FileName_{0}{1}'.format(current_year,current_month)
myFTP.storbinary('STOR %s.xlsx'%file_name,bio)

Not able to download Suitelet through suitescript 1.0

I have created a button to export the form data to simple Excel.
Everything is working file, even if i try to save this excel file in the file cabinet it gets saved correctly.
But when i try to downlaod the excel file, downloads wierd single cell file with special characters or system gives either an error or saves an empty excel file.
Can anyone help me in how to download the excel file from button click. I think i have issue in my responce.
My Code example is as follows:
.
.
.
xmlString += '</Table></Worksheet></Workbook>';// this is my xml string
var xlsFile = nlapiCreateFile('test.xls', 'EXCEL', nlapiEncrypt(xmlString, 'base64'));
response.writeFile(xmlFile);
}
error screenshot:
I think the reason for the response issue is because you are calling a non-existent variable "xmlFile" in writeFile();
try using this writeFile(xlsFile);

Reading an Excel File using BinaryStream reader Without using Microsoft Office DLL

I'm trying to read an excel file from the input Stream.
I want to read line by line and save the column information from Excel to Database.
I'm unable to read the file, Can any one help me to figure out what Im missing.
Here is the code below.
using (System.IO.BinaryReader sr = new System.IO.BinaryReader(fileToUpload.PostedFile.InputStream))
{
do
{
tester.Text = tester.Text + sr.ReadString() + "</br>";
} while (sr.PeekChar() > 0);
}
Thanks
karthik
Normally, in text file, we read line-by-line. I doubt whether Excel also brings data line-by-line (or) you will be able to recognize End-of-line character. If you correlate Excel's row as line, that could be wrong. May be you can try with CSV file, which can be read line-by-line and can be processed as individual lines.

importing a .txt file into a .dat cplex opl

In an optimization problem I need to open my data for the problem in the .dat file. The problem is that the data is in a text file (notebook) and I don't know how I should connect it and work with a lot of instances. Could someone help me? I am searching for it, but I cannot find something that explains clearly.
Open your file in notepad
Go to Save As
Type yourfilename.dat (without space). You should put .dat extension manually
Save
You can read from a text file in cplex like:
execute //you should write this code in an execute block
{
var fileID= new IloOplInputFile("fileName.txt");
var contenct = fileID.readline();
var intContenct = Opl.intValue(contenct); //in case you want to convert what you read into an integer value
fileID.clos();
}

Upload and Save an excel file with BottlePy

I am creating an application using Bottle framework. I need a feature to upload an Excel file.
I am using the following for file upload.
http://bottlepy.org/docs/dev/tutorial.html#post-form-data-and-file-uploads
On the server side I am getting the file data as binary content. I want to save it in a temporary folder as an Excel file.
I am new to Python and Bottle. Any help will be much appreciated.
Thanks
Chirdeep
Your request.files.data object contains the data about your excel file. So you only need to create a temporary folder and save it inside. This can be done using the tempfile module
f = tempfile.NamedTemporaryFile(delete=False, suffix=".xlsx")
f.write(request.files.data.file.read())
f.close()
I was not able to get simple file writing code like yours to work, So I used the tempfile module. Looking at your code, I would have assumed it would write to the directory where the python file is, if the code is working. Try using the code below, if you don't pass arguments to dir, it will create a file in the current directory.
def save_as_temp_file(data):
with tempfile.NamedTemporaryFile(dir=settings.TEMP_PATH,
delete=False,
suffix=".xlsx") as f:
f.write(data.file.read())
return f.name

Resources