DSV (Delimiter-Separated Values) documents are a specific form of text-based spreadsheets with delimiters (separators). There several steps that usage of GroupDocs.Editor Cloud consists of:
Upload input document into cloud storage
Load the document into editable representation in the cloud storage (HTML file and resources)
Download HTML document (and resources, if needed) from storage
Edit HTML document at client side
Upload HTML document back into the storage
Save the edited document into Spreadsheet format in the storage
Download saved document
Steps 1, 3, 4, 5 are storage operations, please refer to this Storage Operations) for usage details. Step 4 is a custom edit operation that can be performed with the programming language or 3rd party tools.
Below is a detailed description of steps 2 and 6.
Loading DSV documents
This REST API provides an ability to load the input documents into an editable representation.
Resources
HTTP POST ~/load
Swagger UI lets you call this REST API directly from the browser. The following properties of loading DSV documents may be customized:
Name
Description
Comment
FileInfo.FilePath
The file path in the storage
Required property
FileInfo.StorageName
Storage name
Could be omitted for default storage
FileInfo.VersionId
File version Id
Useful for storages that support file versioning
FileInfo.Password
The password to open file
Should be specified only for password-protected documents
OutputPath
The full output path
The directory in storage, where editable files will be stored
Separator
Allows to specify a string separator (delimiter) for text-based Spreadsheet documents
If not specified, separator determined according to file extension
ConvertDateTimeData
Gets or sets a value that indicates whether the string in a text-based document is converted to the date data. The default is false.
ConvertNumericData
Gets or sets a value that indicates whether the string in the text-based document is converted to numeric data. The default is false.
TreatConsecutiveDelimitersAsOne
Defines whether consecutive delimiters should be treated as one. By default is false.
cURL example
* First get JSON Web Token
* Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
curl -v "https://api.groupdocs.cloud/connect/token"\
-X POST \
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx"\
-H "Content-Type: application/x-www-form-urlencoded"\
-H "Accept: application/json"* cURL example to load document
curl -v "https://api.groupdocs.cloud/v1.0/editor/load"\
-X POST \
-H "Content-Type: application/json"\
-H "Accept: application/json"\
-H "Authorization: Bearer
<jwt token>"-d "{
'FileInfo': { 'FilePath': 'cells/sample.tsv' },
'OutputPath': 'Output'
}"
// Response will contain storage path to resultant documents
{"resourcesPath":"output\sample.files","htmlPath":"output\sample.html"}
SDK examples
Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Editor Cloud SDKs along with working examples, to get you started in no time. Please check the article to learn how to add an SDK to your project.
// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-dotnet-samplesstringMyAppKey="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloudstringMyAppSid="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyAppSid,MyAppKey);// Create necessary API instancesvareditApi=newEditApi(configuration);varfileApi=newFileApi(configuration);// The document already uploaded into the storage.// Load it into editable statevarloadOptions=newDelimitedTextLoadOptions{FileInfo=newFileInfo{FilePath="Spreadsheet/sample.tsv"},OutputPath="output"};varloadResult=editApi.Load(newLoadRequest(loadOptions));// Download html documentvarstream=fileApi.DownloadFile(newDownloadFileRequest(loadResult.HtmlPath));varhtmlString=newStreamReader(stream,Encoding.UTF8).ReadToEnd();// Edit something...htmlString=htmlString.Replace("32","66");// Upload html back to storagefileApi.UploadFile(newUploadFileRequest(loadResult.HtmlPath,newMemoryStream(Encoding.UTF8.GetBytes(htmlString))));// Save html back to tsvvarsaveOptions=newDelimitedTextSaveOptions{FileInfo=loadOptions.FileInfo,OutputPath="output/edited.tsv",HtmlPath=loadResult.HtmlPath,ResourcesPath=loadResult.ResourcesPath};varsaveResult=editApi.Save(newSaveRequest(saveOptions));
// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-java-samples
StringMyAppKey="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
StringMyAppSid="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(MyAppSid,MyAppKey);// Create necessary API instances
EditApieditApi=newEditApi(configuration);FileApifileApi=newFileApi(configuration);// The document already uploaded into the storage.
// Load it into editable state
FileInfofileInfo=newFileInfo();fileInfo.setFilePath("Spreadsheet/sample.tsv");DelimitedTextLoadOptionsloadOptions=newDelimitedTextLoadOptions();loadOptions.setFileInfo(fileInfo);loadOptions.setOutputPath("output");LoadResultloadResult=editApi.load(newLoadRequest(loadOptions));// Download html document
Filefile=fileApi.downloadFile(newDownloadFileRequest(loadResult.getHtmlPath(),null,null));// Edit something...
List<String>lines=Files.readAllLines(file.toPath());List<String>newLines=newArrayList<String>();for(Stringline:lines){newLines.add(line.replaceAll("32","66"));}Files.write(file.toPath(),newLines);// Upload html back to storage
fileApi.uploadFile(newUploadFileRequest(loadResult.getHtmlPath(),file,Common.MYStorage));// Save html back to tsv
DelimitedTextSaveOptionssaveOptions=newDelimitedTextSaveOptions();saveOptions.setFileInfo(fileInfo);saveOptions.setOutputPath("output/edited.tsv");saveOptions.setHtmlPath(loadResult.getHtmlPath());saveOptions.setResourcesPath(loadResult.getResourcesPath());DocumentResultsaveResult=editApi.save(newSaveRequest(saveOptions));System.out.println("Document edited: "+saveResult.getPath());
// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-php-samples
useGroupDocs\Editor\Model;useGroupDocs\Editor\Model\Requests;$AppSid="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$AppKey="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Editor\Configuration();$configuration->setAppSid($AppSid);$configuration->setAppKey($AppKey);$editApi=newGroupDocs\Editor\EditApi($configuration);$fileApi=newGroupDocs\Editor\FileApi($configuration);// The document already uploaded into the storage
// Load it into editable state
$fileInfo=newModel\FileInfo();$fileInfo->setFilePath("Spreadsheet/sample.tsv");$loadOptions=newModel\DelimitedTextLoadOptions();$loadOptions->setFileInfo($fileInfo);$loadOptions->setOutputPath("output");$loadResult=$editApi->load(newRequests\loadRequest($loadOptions));// Download html document
$htmlFile=$fileApi->downloadFile(newRequests\downloadFileRequest($loadResult->getHtmlPath()));$html=file_get_contents($htmlFile->getRealPath());// Edit something...
$html=str_replace("32","66",$html);// Upload html back to storage
file_put_contents($htmlFile->getRealPath(),$html);$uploadRequest=newRequests\uploadFileRequest($loadResult->getHtmlPath(),$htmlFile->getRealPath());$fileApi->uploadFile($uploadRequest);// Save html back to tsv
$saveOptions=newModel\DelimitedTextSaveOptions();$saveOptions->setFileInfo($fileInfo);$saveOptions->setOutputPath("output/edited.tsv");$saveOptions->setHtmlPath($loadResult->getHtmlPath());$saveOptions->setResourcesPath($loadResult->getResourcesPath());$saveResult=$editApi->save(newRequests\saveRequest($saveOptions));// Done.
echo"Document edited: ".$saveResult->getPath();
# For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-ruby-samplesrequire'groupdocs_editor_cloud'$app_sid="XXXX-XXXX-XXXX-XXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloud$app_key="XXXXXXXXXXXXXXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloud# Create necessary API instances fileApi=GroupDocsEditorCloud::FileApi.from_keys($app_sid,$app_key)editApi=GroupDocsEditorCloud::EditApi.from_keys($app_sid,$app_key)# The document already uploaded into the storage.# Load it into editable statefileInfo=GroupDocsEditorCloud::FileInfo.newfileInfo.file_path='Spreadsheet/sample.tsv'loadOptions=GroupDocsEditorCloud::DelimitedTextLoadOptions.newloadOptions.file_info=fileInfoloadOptions.output_path="output"loadRequest=GroupDocsEditorCloud::LoadRequest.new(loadOptions)loadResult=editApi.load(loadRequest)# Download html documenthtmlFile=fileApi.download_file(GroupDocsEditorCloud::DownloadFileRequest.newloadResult.html_path)htmlFile.openhtml=htmlFile.readhtmlFile.close# Edit something...html=html.gsub("32","66")# Upload html back to storagehtmlFile=File.open(htmlFile.path,"w")htmlFile.write(html)htmlFile.closeuploadRequest=GroupDocsEditorCloud::UploadFileRequest.newloadResult.html_path,File.open(htmlFile.path,"r")fileApi.upload_file(uploadRequest)# Save html back to tsvsaveOptions=GroupDocsEditorCloud::DelimitedTextSaveOptions.newsaveOptions.file_info=fileInfosaveOptions.output_path="output/edited.tsv"saveOptions.html_path=loadResult.html_pathsaveOptions.resources_path=loadResult.resources_pathsaveRequest=GroupDocsEditorCloud::SaveRequest.new(saveOptions)saveResult=editApi.save(saveRequest)puts("Document edited: "+saveResult.path)
// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-node-samples
global.editor_cloud=require("groupdocs-editor-cloud");global.appSid="XXXX-XXXX-XXXX-XXXX";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
global.appKey="XXXXXXXXXXXXXXXX";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
global.editApi=editor_cloud.EditApi.fromKeys(appSid,appKey);global.fileApi=editor_cloud.FileApi.fromKeys(appSid,appKey);// The document already uploaded into the storage.
// Load it into editable state
letfileInfo=neweditor_cloud.FileInfo();fileInfo.filePath="Spreadsheet/sample.tsv";letloadOptions=neweditor_cloud.DelimitedTextLoadOptions();loadOptions.fileInfo=fileInfo;loadOptions.outputPath="output";letloadResult=awaiteditApi.load(neweditor_cloud.LoadRequest(loadOptions));// Download html document
letbuf=awaitfileApi.downloadFile(neweditor_cloud.DownloadFileRequest(loadResult.htmlPath));lethtmlString=buf.toString("utf-8");// Edit something...
htmlString=htmlString.replace("32","66");// Upload html back to storage
awaitfileApi.uploadFile(neweditor_cloud.UploadFileRequest(loadResult.htmlPath,newBuffer(htmlString,"utf-8")));// Save html back to docx
letsaveOptions=neweditor_cloud.DelimitedTextSaveOptions();saveOptions.fileInfo=fileInfo;saveOptions.outputPath="output/edited.tsv";saveOptions.htmlPath=loadResult.htmlPath;saveOptions.resourcesPath=loadResult.resourcesPath;letsaveResult=awaiteditApi.save(neweditor_cloud.SaveRequest(saveOptions));// Done.
console.log("Document edited: "+saveResult.path);
# For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-python-samplesimportgroupdocs_editor_cloudapp_sid="XXXX-XXXX-XXXX-XXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloudapp_key="XXXXXXXXXXXXXXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloudeditApi=groupdocs_editor_cloud.EditApi.from_keys(app_sid,app_key)fileApi=groupdocs_editor_cloud.FileApi.from_keys(app_sid,app_key)# The document already uploaded into the storage.# Load it into editable statefileInfo=groupdocs_editor_cloud.FileInfo("Spreadsheet/sample.tsv")loadOptions=groupdocs_editor_cloud.DelimitedTextLoadOptions()loadOptions.file_info=fileInfoloadOptions.output_path="output"loadResult=editApi.load(groupdocs_editor_cloud.LoadRequest(loadOptions))# Download html documenthtmlFile=fileApi.download_file(groupdocs_editor_cloud.DownloadFileRequest(loadResult.html_path))html=""withopen(htmlFile,'r')asfile:html=file.read()# Edit something... html=html.replace("32","66")# Upload html back to storagewithopen(htmlFile,'w')asfile:file.write(html)fileApi.upload_file(groupdocs_editor_cloud.UploadFileRequest(loadResult.html_path,htmlFile))# Save html back to tsvsaveOptions=groupdocs_editor_cloud.DelimitedTextSaveOptions()saveOptions.file_info=fileInfosaveOptions.output_path="output/edited.tsv"saveOptions.html_path=loadResult.html_pathsaveOptions.resources_path=loadResult.resources_pathsaveResult=editApi.save(groupdocs_editor_cloud.SaveRequest(saveOptions))# Doneprint("Document edited: "+saveResult.path)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.