Search content in remote range Excel API : SearchContentInRemoteRange
Search text in the range of remoted spreadsheet.
Interface Details
Endpoint
Copy PUT http://api.aspose.cloud/v4.0/cells/ {name}/worksheets/ {worksheet}/ranges/ {cellArea}/search/content
Function Description
This method searches for specified text within a range of spreadsheet file stored in remote cloud storage.It supports searching through all sheets and cells of the workbook, identifying occurrences of the search term directly within the cloud environment.The operation is performed remotely, eliminating the need to download the file to the local machine.Ensure that you have valid cloud storage credentials and accessible file paths or identifiers for the target spreadsheet.If the source file cannot be accessed, permissions are insufficient, or if an error occurs during the search process (such as an unsupported file format), an appropriate exception will be thrown.Depending on the implementation, the method may return the locations of the matches (e.g., sheet name, cell coordinates).Users should specify the exact search criteria, including case sensitivity and whole word matching options, to refine search results.
The request parameters of searchContentInRemoteRange API are:
Parameter Name
Type
Path/Query String/HTTPBody
Description
name
String
Path
worksheet
String
Path
cellArea
String
Path
searchText
String
Query
ignoringCase
Boolean
Query
folder
String
Query
storageName
String
Query
(Optional) The name of the storage if using custom cloud storage. Use default storage if omitted.
regoin
String
Query
The spreadsheet region setting.
password
String
Query
The password for opening spreadsheet file.
Response Description
Copy {
"Name" : "SearchResponse" ,
"Type" : "Class" ,
"ParentName" : "CellsCloudResponse" ,
"IsAbstract" : false ,
"Properties" : [
{
"Name" : "TextItems" ,
"Nullable" : true ,
"ReadOnly" : false ,
"IsInherit" : false ,
"DataType" : {
"Identifier" : "Container" ,
"Reference" : "TextItem" ,
"ElementDataType" : {
"Identifier" : "Class" ,
"Reference" : "TextItem" ,
"Name" : "class:textitem"
},
"Name" : "container"
}
},
{
"Name" : "Code" ,
"Nullable" : true ,
"ReadOnly" : false ,
"IsInherit" : true ,
"DataType" : {
"Identifier" : "Integer" ,
"Name" : "integer"
}
},
{
"Name" : "Status" ,
"Nullable" : true ,
"ReadOnly" : false ,
"IsInherit" : true ,
"DataType" : {
"Identifier" : "String" ,
"Name" : "string"
}
}
]
}
OpenAPI Specification
The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.
Excel API SDK
Using an SDK is the best way to speed up the development. An SDK takes care of low-level details and lets you focus on your project tasks. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code examples demonstrate how to make calls to Aspose.Cells web services using various SDKs:
C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Aspose.Cells.Cloud.SDK.Api;
using Aspose.Cells.Cloud.SDK.Model;
using Aspose.Cells.Cloud.SDK.Request;
using System;
using System.IO;
using System.Collections.Generic;
using Range = Aspose.Cells.Cloud.SDK.Model.Range;
public static class Example40_SearchTextInRemoteRange
{
public static void Run()
{
CellsApi cellsApi = new CellsApi("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
string remoteFolder = "TestData/In";
string bookTextXlsx = "BookText.xlsx";
var request = new SearchContentInRemoteRangeRequest(
name: bookTextXlsx,
worksheet: "Sales",
cellArea: "A1:A10",
searchText: "Bike",
ignoringCase: false,
folder: remoteFolder
);
cellsApi.SearchContentInRemoteRange(request);
}
}
Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.aspose.cloud.cells.api;
import com.aspose.cloud.cells.client.*;
import com.aspose.cloud.cells.model.*;
import com.aspose.cloud.cells.request.*;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
import java.util.HashMap;
public class ExampleSearchContentInRemoteRange {
private CellsApi api;
public ExampleSearchContentInRemoteRange(){
try {
api = new CellsApi(
System.getenv("CellsCloudClientId"),
System.getenv("CellsCloudClientSecret"),
"v3.0",
System.getenv("CellsCloudApiBaseUrl")
);
} catch (ApiException e) {
e.printStackTrace();
}
}
public void Run(){
try{
String remoteFolder = "TestData/In";
String bookTextXlsx = "BookText.xlsx";
UploadFileRequest uploadFileRequest = new UploadFileRequest();
uploadFileRequest.setPath( remoteFolder + "/" + bookTextXlsx );
uploadFileRequest.setStorageName( "");
HashMap<String,File> files = new HashMap<String,File>();
files.put( bookTextXlsx , new File(bookTextXlsx ));
uploadFileRequest.setUploadFiles(files);
cellsApi.uploadFile(uploadFileRequest);
SearchContentInRemoteRangeRequest request = new SearchContentInRemoteRangeRequest();
request.setName(bookTextXlsx);
request.setSearchText("Bike");
request.setIgnoringCase(false);
request.setWorksheet("Sales");
request.setCellArea("A1:A10");
request.setFolder(remoteFolder);
this.api.searchContentInRemoteRange(request);
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php
require_once('vendor\autoload.php');
use \Aspose\Cells\Cloud\Api\CellsApi;
use \Aspose\Cells\Cloud\Request\SearchContentInRemoteRangeRequest;
$cellsApi = new CellsApi(getenv("CellsCloudClientId"),getenv("CellsCloudClientSecret"),"v3.0",getenv("CellsCloudApiBaseUrl"));
$remoteFolder = "TestData/In";
$bookTextXlsx = "BookText.xlsx";
CellsApiTestBase::ready( $this->instance,$bookTextXlsx ,$remoteFolder . "/" . $bookTextXlsx , "");
$request = new SearchContentInRemoteRangeRequest();
$request->setName( $bookTextXlsx);
$request->setWorksheet( "Sales");
$request->setCellArea( "A1:A10");
$request->setSearchText( "Bike");
$request->setIgnoringCase( 'false');
$request->setFolder( $remoteFolder);
$$cellsApi->searchContentInRemoteRange($request);
Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl'
require 'bundler'
require 'aspose_cells_cloud'
@instance = AsposeCellsCloud::CellsApi.new(ENV['CellsCloudClientId'], ENV['CellsCloudClientSecret'],'v3.0',ENV['CellsCloudApiBaseUrl'])
remote_folder = 'TestData/In'
book_text_xlsx = 'BookText.xlsx'
mapFiles = { }
mapFiles[book_text_xlsx] = ::File.open(File.expand_path("TestData/"+book_text_xlsx),"r")
uploadrequest = AsposeCellsCloud::UploadFileRequest.new( { :UploadFiles=>mapFiles,:path=>remote_folder })
@instance.upload_file(uploadrequest)
request = AsposeCellsCloud::SearchContentInRemoteRangeRequest.new(:name=>book_text_xlsx,:worksheet=>'Sales',:cellArea=>'A1:A10',:searchText=>'Bike',:ignoringCase=>false,:folder=>remote_folder);
@instance.search_content_in_remote_range(request);
Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs');
var path = require('path');
const _ = require('asposecellscloud');
const cellsApi = new CellsApi(process.env.CellsCloudClientId, process.env.CellsCloudClientSecret,"v3.0",process.env.CellsCloudApiBaseUrl);
var remoteFolder = "TestData/In"
var bookTextXlsx = "BookText.xlsx"
var bookTextXlsxRequest = new model.UploadFileRequest();
bookTextXlsxRequest.uploadFiles ={bookTextXlsx:fs.createReadStream(localPath + bookTextXlsx)};
bookTextXlsxRequest.path = remoteFolder + "/" + bookTextXlsx ;
bookTextXlsxRequest.storageName ="";
cellsApi.uploadFile(bookTextXlsxRequest );
var request = new model.SearchContentInRemoteRangeRequest();
request.name = bookTextXlsx;
request.worksheet = "Sales";
request.cellArea = "A1:A10";
request.searchText = "Bike";
request.ignoringCase = false;
request.folder = remoteFolder;
return cellsApi.searchContentInRemoteRange(request).then((result) => {
expect(result.response.statusCode).to.equal(200);
});
Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os
import sys
from asposecellscloud.apis.cells_api import CellsApi
from asposecellscloud.models import *
from asposecellscloud.requests import *
api = CellsApi(os.getenv('CellsCloudClientId'),os.getenv('CellsCloudClientSecret'),"v3.0",os.getenv('CellsCloudApiBaseUrl'))
remote_folder = 'TestData/In'
book_text_xlsx = 'BookText.xlsx'
mapFiles = {
local_name: local_name
}
request = UploadFileRequest( mapFiles, remote_folder + '/' + remote_name,storage_name= '')
api.upload_file(request)
request = SearchContentInRemoteRangeRequest( book_text_xlsx, 'Sales', 'A1:A10', 'Bike',ignoring_case= false,folder= remote_folder)
api.search_content_in_remote_range(request)
Perl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use lib 'lib';
use strict;
use warnings;
use File::Slurp;
use MIME::Base64;
use AsposeCellsCloud::CellsApi;
my $config = AsposeCellsCloud::Configuration->new( client_id => $ENV{'CellsCloudClientId'}, client_secret => $ENV{'CellsCloudClientSecret'});
my $instance = AsposeCellsCloud::CellsApi->new(AsposeCellsCloud::ApiClient->new( $config));
my $remoteFolder = 'TestData/In';
my $bookTextXlsx = 'BookText.xlsx';
my $upload_file_request = AsposeCellsCloud::Request::UploadFileRequest->new( 'UploadFiles'=>{ $bookTextXlsx => $bookTextXlsx } ,'path'=>$remoteFolder . '/' . $bookTextXlsx );
my $request = AsposeCellsCloud::Request::SearchContentInRemoteRangeRequest->new();
$request->{name} = $bookTextXlsx;
$request->{worksheet} = 'Sales';
$request->{cell_area} = 'A1:A10';
$request->{search_text} = 'Bike';
$request->{ignoring_case} = 'false';
$request->{folder} = $remoteFolder;
$instance->search_content_in_remote_range(request=> $request);
Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main
import (
"os"
asposecellscloud "github.com/aspose-cells-cloud/aspose-cells-cloud-go"
)
func main() {
instance := asposecellscloud.NewCellsApiService(os.Getenv("ProductClientId"), os.Getenv("ProductClientSecret"), "https://api.aspose.cloud", "v3.0")
remoteFolder := "TestData/In"
bookTextXlsx := "BookText.xlsx"
bookTextXlsxRequest := new(asposecellscloud.UploadFileRequest)
bookTextXlsxRequest.UploadFiles = make(map[string]string)
bookTextXlsxRequest.UploadFiles[bookTextXlsx] = bookTextXlsx
bookTextXlsxRequest.Path = remoteFolder + "/" + bookTextXlsx
bookTextXlsxRequest.StorageName =""
instance.UploadFile(bookTextXlsxRequest )
request := new (asposecellscloud.SearchContentInRemoteRangeRequest)
request.Name = bookTextXlsx
request.Worksheet = "Sales"
request.CellArea = "A1:A10"
request.SearchText = "Bike"
request.IgnoringCase = false
request.Folder = remoteFolder
_, httpResponse, err := instance.SearchContentInRemoteRange(request)
if err != nil {
t.Error(err)
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
t.Fail()
}
}