Zum Hauptinhalt springen

Zeilen aktualisieren in Excel

PDF4me Zeilen aktualisieren ist ein REST Endpunkt, der schreibt JSON Daten in bestehende Zeilen eines Excel Arbeitsbuch. POST die .xlsx als Base64 Zu office/ApiV2Excel/ExcelUpdateRows mit Ihren Daten in jsonInput, Zielzeilen von Excel Tabellenname oder anhand von 1-basierten Koordinaten, dann die aktualisierte Arbeitsmappe dekodieren. JSON Antwort. Die Umwandlung von Zahlen und Datumsangaben erfolgt standardmäßig automatisch.

Was dieser Endpunkt bewirkt

Benötigt ein Arbeitsbuch plus ein JSON Ein Array von Objekten und schreibt diese Werte in bestehende Zeilen: aktualisierte Preise in einer Preisliste, korrigierte Datensätze in einem Bericht, synchronisierte Felder aus Ihrem CRMSie entscheiden mit einem von zwei Targeting-Modi, einem benannten, wo die Daten landen. Excel Tabelle oder genaue Zeilen- und Spaltenkoordinaten. Die Antwort lautet: JSON mit der aktualisierten Arbeitsmappe als Base64 Inhalt.

Verwandte Blog-Beiträge
Zu dieser Funktion gibt es noch keinen Blogbeitrag – folgt in Kürze.
Schauen Sie sich in der Zwischenzeit im PDF4me-Blog Tutorials und Arbeitsabläufe für alle Plattformen an.
Besuchen Sie den Blog

Authentifizierung Ihres API Anfrage

Jeder PDF4me REST Der Anruf muss Ihre API Schlüssel im Authorization Header als Basic Auth. Ihren Schlüssel erhalten oder ändern Sie ihn im Entwickler-Dashboard.

Endpunkt

POSToffice/ApiV2Excel/ExcelUpdateRows

Wichtige Fakten, die Sie nicht verpassen sollten

jsonInput ist ein String, kein JSON Array
Die Aktualisierungsdaten werden als Escape-Sequenz übertragen. JSON Zeichenkette innerhalb jsonInputDas Senden eines unformatierten Arrays ist die häufigste Ursache für einen 400-Fehler an diesem Endpunkt. Serialisieren Sie das Array zuerst, bevor Sie es einbetten.
Zwei Targeting-Modi, ausgewählt durch tableName
Ein nicht leerer Tabellenname wechselt in den Tabellenmodus mit excelRowNumberEin leeres Feld bedeutet Koordinatenmodus mit insertFromRow/insertFromColumnAlle Positionen basieren auf 1.
Die Antwort lautet: Base64 JSONnicht die Datei
Das aktualisierte Arbeitsbuch kommt als ein Base64 Zeichenkette innerhalb eines JSON Körper mit fileName, success, Und Fehlermeldung. Vor dem Speichern dekodieren; die Rohantwort ist keine gültige .xlsx-Datei.

HTTP aufstellen

Verfahren: POST
URL: https://api.pdf4me.com/office/ApiV2Excel/ExcelUpdateRows
Inhaltstyp: application/json
Authorization: Basic <Ihre PDF4me API Schlüssel>

Die Antwort lautet: JSON: Überprüfen Sie die success Flagge, dann Base64-Dekodieren Sie den zurückgegebenen Arbeitsmappeninhalt und speichern Sie ihn mit einem .xlsx Verlängerung.

Soll ich den Tabellenmodus oder den Koordinatenmodus verwenden?

Die beiden Modi dienen unterschiedlichen Arbeitsblattlayouts, und die Auswahl des falschen Modus ist der übliche Grund dafür, dass eine Aktualisierung in den falschen Zellen landet.

Tabellenmodus vs. KoordinatenmodusTabellenmodusKoordinatenmodus
Wie man es auswähltSatz tableName an einen benannten Excel TischVerlassen tableName leer
Wo die Daten landenReihe excelRowNumber innerhalb der Tabelle (1-basiert)Ab insertFromRow/insertFromColumn (basierend auf 1, also 1/1 = A1)
SpaltenübereinstimmungJSON Eigenschaftsnamen werden Tabellenspaltenüberschriften zugeordnetDie Werte werden von links nach rechts aus der Startspalte geschrieben.
Übersteht LayoutänderungenJa, das Update folgt der Tabelle, wenn sie sich verschiebt.Nein, Koordinaten sind feste Positionen
Am besten geeignet fürStrukturierte Arbeitsblätter mit echten Excel TabellenEinfache Bereiche und Ad-hoc-Blätter

API Körperfelder

ParameterErforderlichTypWas es tutBeispiel
documentRequiredobjectDocument reference carrying Name, the Excel filename with its extension.{ "Name": "data.xlsx" }
docContentRequiredstringBase64-encoded bytes of the workbook to update.UEsDBBQABgAIAAAA...
updateRowsToExcelActionRequiredobjectAction configuration object holding jsonInput and all targeting options below.{ "jsonInput": "..." }
jsonInputRequiredstringInside the action object. A STRING containing an escaped JSON array of objects; property names become column targets in table mode."[{\"Name\":\"John\",\"Age\":31}]"
worksheetNameOptionalstringInside the action object. Target worksheet; defaults to the first sheet when omitted.Sheet1
tableNameConditionalstringInside the action object. Names the Excel table for table mode. Empty or omitted switches the action to coordinate mode.SalesTable
excelRowNumberConditionalnumberInside the action object. Table mode only: the 1-based row position within the table to update.5
insertFromRowConditionalnumberInside the action object. Coordinate mode only: the 1-based worksheet row where writing starts.10
insertFromColumnConditionalnumberInside the action object. Coordinate mode only: the 1-based worksheet column where writing starts.1
convertNumericAndDateOptionalbooleanInside the action object. true (default) writes numeric-looking and date-looking values as real Excel numbers and dates instead of text.true
cultureNameOptionalstringInside the action object. Culture used to parse dates and numbers, for example en-US or de-DE. Pair with convertNumericAndDate.en-US

Beispielnutzlasten

Tabellenmodus: Zeile 5 einer benannten Tabelle aktualisieren

{
"document": { "Name": "sales.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"updateRowsToExcelAction": {
"jsonInput": "[{\"Region\":\"EMEA\",\"Revenue\":125000}]",
"worksheetName": "Q3",
"tableName": "SalesTable",
"excelRowNumber": 5
}
}

Koordinatenmodus: Schreiben ab Zelle A10

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"updateRowsToExcelAction": {
"jsonInput": "[{\"Name\":\"John\",\"Age\":31},{\"Name\":\"Ana\",\"Age\":28}]",
"insertFromRow": 10,
"insertFromColumn": 1,
"convertNumericAndDate": true,
"cultureName": "en-US"
}
}

Tipps zur Postboten-Abholung

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON. jsonInput must be a string: escape the inner quotes or use your HTTP library to serialize the array first, then assign it as a string.
Targeting
tableName set = table mode with excelRowNumber. tableName empty = coordinate mode with insertFromRow/insertFromColumn. Both are 1-based.
Response
JSON with a success flag and Base64 workbook content. Decode the document field before saving as .xlsx.

curl-Beispiel

curl -X POST https://api.pdf4me.com/office/ApiV2Excel/ExcelUpdateRows \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"document": { "Name": "data.xlsx" },
"docContent": "'"$(base64 -w 0 data.xlsx)"'",
"updateRowsToExcelAction": {
"jsonInput": "[{\"Name\":\"John\",\"Age\":31}]",
"insertFromRow": 10,
"insertFromColumn": 1
}
}' \
--output response.json

Was bedeutet das? API zurückkehren?

A JSON Ergebnis, das die aktualisierte Arbeitsmappe enthält Base64Die

FeldTypWas es enthält
documentString (Base64)The updated workbook content. Decode to bytes and save with an .xlsx extension.
fileNameStringOutput filename for the updated workbook.
successBooleantrue when the update succeeded. Check this before decoding content.
errorMessageStringPopulated when success is false: malformed jsonInput, a missing table or worksheet, or invalid Base64.

Die Ausgabe bleibt ein Standard Büro geöffnet XML Die Arbeitsmappe bleibt unverändert, Formeln, Formatierungen und Tabellenblätter außerhalb der aktualisierten Zellen bleiben also unberührt.

Codebeispiele

Excel Büroendpunkte sind noch nicht durch die pro-language Beispielordner; das Beispiel-Repository enthält das Anfragemuster, das von jedem verwendet wird PDF4me Endpunktfamilie:

Häufig gestellte Fragen

Why does the API reject my jsonInput with a 400 error?+
jsonInput is a string field that contains JSON, so the inner quotes must be escaped. Sending a raw JSON array instead of a string-encoded one is the most common cause of a 400 Bad Request on this endpoint.
Should I use table mode or coordinate mode?+
Use table mode (tableName plus excelRowNumber) when the worksheet has a named Excel table: the update follows the table even if it moves. Use coordinate mode (insertFromRow and insertFromColumn, tableName empty) for plain ranges at fixed positions.
Are the row and column numbers 0-based or 1-based?+
1-based. insertFromRow 1 and insertFromColumn 1 address cell A1, and excelRowNumber 1 is the first data row of the table. This differs from some other PDF4me Excel actions where worksheet indexes are 0-based.
Is the response the Excel file itself?+
No. The API returns JSON containing the updated workbook as a Base64 string plus fileName, success, and errorMessage fields. Decode the document field to bytes before saving as .xlsx.
How are numbers and dates handled?+
convertNumericAndDate defaults to true, so values that look like numbers or dates are written as real Excel numbers and dates rather than text. Pair it with cultureName so formats like 31.12.2026 or 12/31/2026 parse correctly.
What is the difference between Update Rows and Add Rows?+
Update Rows overwrites values in rows that already exist at the targeted position. Add Rows appends or inserts new rows. If you point Update Rows at empty cells it simply writes the values there; it does not shift existing data down.
Can I update rows in a protected workbook?+
No. Protection blocks editing. Chain the Unlock Excel action first with the correct password, run the update, then re-apply protection with Secure Excel Document if needed.

Warum aktualisieren? Excel Zeilen über API statt manuell?

Die manuelle Methode besteht darin, jede Arbeitsmappe zu öffnen, die Zeilen zu suchen, die Werte neu einzugeben und zu speichern: einmalig praktikabel, aber nicht für eine nächtliche Synchronisierung. CRM oder Datenbank. Die API Führt dieselbe Bearbeitung durch wie eine deterministische Anfrage pro Datei und behält diese bei Excel Tabellen intakt und braucht nie Excel Auf dem Server installiert. Die Ausgabe ist ein Standard Büro geöffnet XML Die Arbeitsmappe ist bereit für den nächsten Schritt im Produktionsprozess.

Ähnliche Aktionen

Dieselbe Aufgabe auf anderen Plattformen

Hilfe erhalten