Importing csv/xls format files with smartGWT - smartgwt

I am using smartgwt free version (not EE). Is there a built in widget to handle importing .csv or excel format files?
I can currently export records from a listGrid to csv. I want to be able to open up another browser, and import the csv file, and based on the configuration that I have exported onto the csv file, re-create the records that I have exported.

I've done the same thing, to achieve that I would suggest a custom datasource using gwt-rpc. You can get the code here.
https://code.google.com/p/smartgwt-extensions/
The thing is I've used gwtupload to send the excel file to the server. Once that is done call fetch to your custom datasource with the file path that was uploaded to the server. Using Apache POI on the server side to parse the data and return that as a result to your datasource fetch call. Within the execute fetch create Record objects and add them to your grid.
you can get the gwtupload from here,
https://code.google.com/p/gwtupload/wiki/GwtUpload_GettingStarted

Related

How to read a csv file while developing an ios app using xcode

I'm now developing an iOS app using xcode(Swift). I'd like to import the data which is stored in a csv file, but I'm not sure where to import the data. (I just want the words from the csv file can be represented on the screen.) Should I create a core data file? How can I import an existing csv file into the project?
You can find several resources on Github for importing CSV files, like this one. You'll probably want to use them with CocoaPods.
Where to store the data in a CSV file really depends on what you want to use it for. If you want to allow your users to import data that they might want to persist and manage, you'll want to set up a CoreData of SQLite database.
However, if just displaying data on the screen is all you need, this won't be necessary and you can just use Dictionaries or Arrays to work with the data you get from the CSV File. Keep in mind, though, that this would require you to import the CSV file every time you launch the app.

How to validate data inside a csv or excel file?

I currently have a mvc task to validate the data inside the csv or excel file before it uploads to sharepoint.
I need to validate the data such as phone number format and other types of data inside the uploaded csv or excel file.if the phone number format inside the file is not correct(ex: (985)-265-abcd) the file should not validate/upload and it has thorw validation error.
Is there any way to achieve that kind of functionality
You need to create an event receiver that fires when the item is being added to the library. At that point, you need to get your file, run the validation logic, and if validation fails, cancel the event to prevent the file from uploading.

Convert automatically Google Sheets docs to .txt tabular text file

I want to import Google-SpreadSheet data to lotus notes but not do no support the import from .gsheet filo so i want to automatically convert .gsheet doc to .txt file and after that import it using LotusNotes Script to create a doc with informations contained in that doc.
I must have to start form a .gsheet file.
Which are my options?
Can i use windows scipt ?
The first step is, to get the csv from the spreadsheet. Accoring to responses to this post in stackoverflow this is simply a matter of using the right url.
As soon as you have the url you can use LotusScript- Functions to call that URL and import the csv- data to your documents / database.
Just google for the right starting point (e.g. "lotusscript read web site") and come back if you have concrete questions in your created script.

Strategy in exporting to Excel with formatting from ASP.NET?

So this is another exporting to Excel question.
I have a page that has a table with formatting by stylesheet.
When I export the page by setting the ContentType to application/excel and Content-Disposition to attachment, I can export the table to Excel (not CSV). However, it loses all formatting. I think it's because Excel does not load CSS and I guess that's reasonable.
So, in a scenario where I have to show the table on the web and also export to Excel, both with similar (even if not exact) formatting, what would be the best approach without using something like NPOI?
I am trying to minimize the work and keep the single template if possible. Is it necessary for me to create two separate templates: one with stylesheet, the other with embedded style in the table itself for Excel?
Having a single template with conditional formatting inside would be very messy.
Any ideas?
If you not yet solve the problem I'll recommend you to use Open XML SDK 2.0 for Microsoft Office (see http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&displaylang=en). With this way you will be able create an XLSX file without installing Excel on the server. XLSX file is compressed (like ZIP file) collection of xml files. Open XML SDK 2.0 helps you create and change XLSX file as pure xml files. At the first time if you look at Open XML SDK a lot of things look like strange, but it's only at the beginning. There are so named "Open XML SDK 2.0 Productivity Tool" (a part of Open XML SDK 2.0) which can generate a lot of useful code for you. Moreover you can create a nice Excel document which you can use as a prototype (template) of the document which you will create. So you can solve the problem of complex formating without writing of a lot of code.
Look at http://msdn.microsoft.com/en-us/library/cc850837(v=office.14).aspx for some examples and on http://openxmldeveloper.org/default.aspx. See also Creating Excel document with OpenXml sdk 2.0 as a start example. You can find also a lot of good stuffs on http://www.codeplex.com about Open XML SDK
there are several aproach
you could instantiate a excel object on your server using VSTO, and then write the document on memory and write to response the native file, but this aproach could be a litle expensive if you create a excel object per request, so you could try to do a singleton object that wraps the excel object instance
You can create a report (rdlc file) with a similar look to the grid. Then, you can have an action where you instantiate a LocalReport, pass the data you want to it and call its Render method. You then return the byte array returned by the Render method.

Programmatically load CSV file into Excel Worksheet (Delphi 7)

I have a large amount of data to insert into an worksheet of an existing Excel workbook. The Excel workbook will have other worksheets containing calculations and a pivot tables. The data may have as many as 60,000 rows and more than 30 columns. This solution must work for both Excel 2003 and Excel 2007.
Using the Excel OLE object is way too slow so we are attempting to load the data from a CSV file. We have come up with a method to load the data by placing the data onto the clipboard and then pasting it into the worksheet. I feel this is a quite a kludge. Is there another way to programmatically load a CSV file into a worksheet? Or perhaps a different solution altogether?
Update: We got slammed with another task before we could fully investigate the answers. We should be able to get back to this in a couple of weeks. I'll be sure to update again when we get back to this task.
Thanks for all of the answers to date!
XLSReadWrite is a component that can read and write excel files from Delphi. It's fast and it has support for Excel 2003 and 2007. You can create new excel files as well as open existing ones and add/modify them.
Also you do not need to have Excel installed to be able to use it.
See http://www.axolot.com/components/xlsrwii20.htm
Any chance you can drop the requirement for this to work with Office 2003? I would have recommended the Open XML Format SDK. It lets you bind managed code assemblies to spreadsheet documents that can handle events such as Open or Close, and read and write to cells in the document, among other things. Alternatively, you can use it to manipulate XSLX documents from an application. Quite slick, actually.
Since this won't work for you, how about writing a macro that pulls in the CSV file when the spreadsheet is loaded?
you can load the csv into listview or usin OLEDB provider to load it on DBGrid, then export it into xls file format using TMxExport component from Max Components:
Max Components
Have you tried linking the csv file directly into the worksheet.
Go to Data -> Import External Data -> Import Data
change the file type to 'Text Files'
You can then refresh the worksheet when the csv is update.
NOTE: I have not done this with the volume of data you have indicated, so YMMV
Actually there is a way that is quite fast, pretty old tech (nowdays) but is probably the fastest.
It's ADO or for earlier versions DAO (note not ADO.NET)
You can read a CSV file using ADO and the JET Engine to get the data into a ADO recordset, then an Excel Range Object has a CopyFromRecordSet method that will copy (very fast) from the ADO (or DAO) recordset.
http://msdn.microsoft.com/en-us/library/aa165427(office.10).aspx
You can try to use Tab Separated Values instead of CSV - than you just paste this into Excel :)

Resources