csv zuwa tv online

Yadda ake canza CSV zuwa TSV tare da NET Cloud SDK.

Ikon daidaitawa da canza bayanai ba tare da wani lahani ba shine ginshiƙi don cin nasarar kowace kasuwanci. Wannan shine inda juyawa daga CSV zuwa TSV yana ɗaukar mahimmancin mahimmanci. A cikin wannan labarin, mun zayyana dalilan da suka haifar da wannan sauyi tare da ba da haske kan fa’idodi masu yawa da yake kawowa a gaba. Wannan jujjuyawar daga Ƙimar-Waƙafi (CSV) zuwa Ƙimar-Raba Tabba (TSV) ta amfani da NET Cloud SDK yana fitowa azaman mafita mai canza wasa.

NET Cloud SDK don CSV zuwa Juyawa TSV

Aspose.Cells Cloud SDK for .NET gidan wuta ne wanda ba kawai yana jujjuya CSV zuwa TSV ba don haɓaka daidaito da tsayuwar bayanai, amma kuma yana buɗe hanyoyi don ci-gaba maƙunsar manipulation. Yana daidaita rata tsakanin tsarin bayanai daban-daban kuma yana tabbatar da aiki tare, yana sa sadarwar bayanai ta fi dacewa. Bayan jujjuya tsarin, yana ba ku ƙarfin saiti na fasali don ƙirƙirar fayil ɗin Excel mai ƙarfi, gyarawa, da hakar bayanai.

Domin amfani da SDK, muna buƙatar bincika ‘Aspose.Cells-Cloud’ a cikin manajan fakitin NuGet kuma danna maɓallin ‘Ƙara Kunshin’. Na biyu, sami takaddun shaidar abokin ciniki daga dashboard ɗin girgije. Idan ba ku da asusun da ke akwai, kawai ƙirƙirar asusun kyauta ta bin umarnin da aka kayyade a cikin labarin saurin farawa.

Canza CSV zuwa TSV a cikin C# .NET

Wannan sashe yana ba da cikakkun bayanai kan yadda za mu iya canza tsarin CSV zuwa tsarin TSV a cikin C# .NET.

CellsApi cellsInstance = new CellsApi(clientID, clientSecret);

Da farko, ƙirƙiri wani abu na ajin CellsApi inda muke ƙaddamar da shaidar abokin ciniki azaman muhawara.

SaveOptions saveOptions = new SaveOptions()

Na biyu, ƙirƙirar misali na SaveOptions aji inda muke ayyana tsarin fitarwa azaman TSV.

PostWorkbookSaveAsRequest postworkbookSaveAsRequest = new PostWorkbookSaveAsRequest()

Na uku, ƙirƙiri misali na ‘PostWorkbookSaveAsRequest’ inda muka ƙididdige sunan shigar da fayil ɗin CSV, sunan sakamakon fayil ɗin TSV da sigogi zuwa ginshiƙan AutoFit da layuka.

cellsInstance.PostWorkbookSaveAs(postworkbookSaveAsRequest);

A ƙarshe, kira API don canza CSV zuwa TSV akan layi. Bayan nasarar nasara, ana adana sakamakon TSV a cikin ajiyar girgije.

// Don cikakkun misalai da fayilolin bayanai, da fatan za a je zuwa 
https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet/

// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
string clientID = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";

// ƙirƙiri misalin CellsApi yayin wuce ClientID da ClientSecret
CellsApi cellsInstance = new CellsApi(clientID, clientSecret);

// sunan shigar da fayil CSV
string input_CSV = "source.csv";
// Sakamakon TSV fayil
string resultant_TSV = "output.tsv";

try
{
    // karanta abun ciki na shigar da fayil CSV
    var file = System.IO.File.OpenRead(input_CSV);

    // SaveOption abu yana bayyana tsarin fitarwa azaman TSV
    SaveOptions saveOptions = new SaveOptions()
    {
        SaveFormat = "TSV",
        ClearData = true
    };
    
    // Buƙatar adana littafin aiki
    PostWorkbookSaveAsRequest postworkbookSaveAsRequest = new PostWorkbookSaveAsRequest()
    {
        name = input_CSV,
        newfilename = resultant_TSV,
        isAutoFitRows = true,
        isAutoFitColumns = true
    };

    // fara aikin juyawa
    var response = cellsInstance.PostWorkbookSaveAs(postworkbookSaveAsRequest);

    // lokacin da tuba ta yi nasara, buga saƙon nasara
    if (response != null && response.Equals("OK"))
    {
        Console.WriteLine("The CSV to TSV conversion completed successfully !");
        Console.ReadKey();
    }
}
catch (Exception ex)
{
    Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
csv zuwa tv canza

Samfoti na juyawa CSV zuwa TSV.

Za’a iya sauke samfurin fayil ɗin CSV da sakamako na TSV daga:

CSV zuwa TSV tare da Umarnin CURL

Hakanan kuna iya juyar da CSV zuwa TSV ba tare da wahala ba tare da Aspose.Cells Cloud ta amfani da umarnin CURL. Don haka, yi amfani da ikon umarnin CURL don haɗawa da Aspose.Cells Cloud wanda ke ba da damar ingantacciyar jujjuyawar tsari da ci-gaba manipulation. Bugu da ƙari, tare da wannan hanya mai sauƙi amma mai ƙarfi, buɗe yuwuwar sarrafa fayil ɗin Excel mai ƙarfi, ba ku damar ƙirƙira, gyara, da cire bayanai ba tare da matsala ba.

Mataki na farko a wannan hanyar shine samar da alamar samun damar JWT ta amfani da umarni mai zuwa:

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=921363a8-b195-426c-85f7-7d458b112383&client_secret=2bf81fca2f3ca1790e405c904b94d233" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Da zarar an ƙirƙiri JWT, da fatan za a aiwatar da wannan umarni don adana CSV zuwa tsarin TSV. Bayan tuba, ana adana sakamakon TSV a cikin ajiyar girgije.

curl -v "https://api.aspose.cloud/v3.0/cells/{sourceFile}/SaveAs?newfilename={output}&isAutoFitRows=true&isAutoFitColumns=true&checkExcelRestriction=false" \
-X POST \
-H  "accept: application/json" \
-H  "authorization: Bearer {accessToken}" \
-H  "Content-Type: application/json" \
-d "{  \"SaveFormat\": \"TSV\",  \"ClearData\": true,  \"CreateDirectory\": true,  \"EnableHTTPCompression\": true,  \"RefreshChartCache\": true,  \"SortNames\": true,  \"ValidateMergedAreas\": true}"

Sauya ‘sourceFile’ tare da sunan shigar da fayil ɗin CSV da ke samuwa a cikin ma’ajiyar girgije, ‘‘fitarwa’ tare da sunan sakamakon fayil ɗin TSV da za a ƙirƙira a cikin ma’ajin gajimare da ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.

Kammalawa

A ƙarshe, ko kun zaɓi cikakkiyar damar Aspose.Cells Cloud SDK don NET ko ingantaccen ingantaccen umarnin CURL tare da Aspose.Cells Cloud, tafiya daga CSV zuwa TSV ta zama maras kyau da ƙwarewa. SDK ba wai kawai yana sauƙaƙe jujjuya tsari ba tare da wahala ba har ma yana ba da ingantaccen sarrafa maƙunsar rubutu, yana tabbatar da ingantaccen bayanan bayanai da haɗin kai. A gefe guda, umarnin CURL yana ba da hanya mai sauƙi amma mai ƙarfi don haɗawa da Aspose.Cells Cloud, ƙyale masu haɓakawa su yi amfani da ikon REST APIs don sarrafa fayil ɗin Excel mai ƙarfi.

Hanyoyin haɗi masu amfani

Labarai masu alaka

Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: